mysql's Examples

MySQL Create Query With the help of an example, let us learn how to build a table in the database. If we set the password during installation, open the MySQL console and write it down. Now go to the database where you want to make a table and open it. Using the following line, we will create a table named "employee table" in the database "employeedb":

Syntax:-

mysql> CREATE TABLE employee_table(  
    id int NOT NULL AUTO_INCREMENT,  
    name varchar(45) NOT NULL,  
    occupation varchar(35) NOT NULL,  
    age int NOT NULL,  
    PRIMARY KEY (id)  
);

MySQL Create Database We can create a new database in MySQL by using the CREATE DATABASE statement with the below

Syntax:-

CREATE DATABASE [IF NOT EXISTS] database_name  
[CHARACTER SET charset_name]  
[COLLATE collation_name];

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us