how to create database code example
Example 1: sql crate database
CREATE DATABASE databasename;
Example 2: create database in mysql
The CREATE DATABASE statement is used to create a new SQL/MySQL database.
Syntax
CREATE DATABASE databasename;
CREATE DATABASE Example
The following SQL statement creates a database called "testDB":
Example
CREATE DATABASE testDB;
Example 3: create database sql
CREATE TABLE example (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
Example 4: sql create database
Creates a new database.
Example: Creates a new database named ‘websitesetup’.
CREATE DATABASE websitesetup;
Example 5: CREATE DATABASE DatabaseName;
SHOW DATABASES;
DROP DATABASE testDB;
USE DatabaseName;
SQL> CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
DESC CUSTOMERS;
Example 6: create a db
CREATE DATABASE <DB_NAME>;
CREATE TABLE <TB_NAME>(
<Elem 0> <Type_of_Elem created> <ADD_PROPRETIES>,
...
...
...
<Elem n> <Type_of_Elem created>
);