![]() It sets the columns’ data types, and sets the ActorId column as the primary key. The following script creates a database (if it doesn’t already exist), then creates a table with two columns. Starting with DROP DATABASE IF EXISTS will drop the database if it already exists. Then the CREATE DATABASE statement can go ahead and create the new database as specified. CREATE SCHEMA Music Īdding IF NOT EXISTS will only create the database if it doesn’t already exist. ![]() You can choose which one you prefer to use. The following statement does exactly the same thing ( CREATE SCHEMA is a synonym for CREATE DATABASE). The following statement creates a blank database called “Music”. ![]() Sample Scriptsīelow are examples of scripts that create a database. To create those, you need to include CREATE TABLE and other statements in your script. It won’t create any tables or other database objects. The script can be as simple as CREATE DATABASE myDatabase but this will create a blank database. ![]() You can see the tables and their columns open in the left navigation pane. In this case, the script has just run and has created the “Music” database. Example of an SQL script that creates a database with tables, columns etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |