Αποτελέσματα Αναζήτησης
Working with databases. Create a database with a specified name if it does not exist in the database server. CREATE DATABASE [IF NOT EXISTS] database_name; Code language: SQL (Structured Query Language) (sql) Use a database or change the current database to another database that you are working with:
To create a database: CREATE DATABASE zoo; To list all the databases on the server: SHOW DATABASES; To use a specified database: USE zoo; To delete a specified database: DROP DATABASE zoo; To list all tables in the database: SHOW TABLES;
To create a new database in MySQL, you use the CREATE DATABASE statement. The following illustrates the basic syntax of the CREATE DATABASE statement: CREATE DATABASE [IF NOT EXISTS] database_name. [CHARACTER SET charset_name] [COLLATE collation_name]; Code language: SQL (Structured Query Language) (sql) In this syntax:
13 Απρ 2020 · A cheat sheet for MySQL with essential commands. Work with tables, columns, data types, indexes, functions, and more. Free to download as .pdf.
8 Αυγ 2024 · Whether you’re just starting out or you’re a seasoned developer, this cheat sheet will help you navigate MySQL more efficiently. This guide covers a broad spectrum of MySQL commands, functions, and tips that are essential for day-to-day database management. Basic MySQL Commands Create a Database
Set c1 and c2 as a primary key. CREATE TABLE t( c1 INT, c2 INT, c3 VARCHAR, PRIMARY KEY (c1,c2) ); Set c2 column as a foreign key. CREATE TABLE t1( c1 INT PRIMARY KEY, c2 INT, FOREIGN KEY (c2) REFERENCES t2(c2) ); Make the values in c1 and c2 unique. CREATE TABLE t( c1 INT, c1 INT, UNIQUE(c2,c3) );