Basic Syntax

Create a new database:

CREATE DATABASE db1;

Show existing databases:

SHOW DATABASES;

Use a database:

use db1

Display current database:

SELECT DATABASE();

Create a new table:

CREATE TABLE tb1 (empid VARCHAR(10),name VARCHAR(10),age INT);

Show all tables:

SHOW TABLES;

Examine the columns of a table (DESC == DESCRIBE):

DESC tb1;

Insert five entries into a table:

INSERT INTO tb1 (empid,name,age)
VALUES ('A101','employee1',40),
('A102','employee2',28),
('A103','employee3',20),
('A104','employee4',23),
('A105','employee5',35);

Show all records from a table:

Duplicate the table manually:

Last updated

Was this helpful?