0% found this document useful (0 votes)
14 views5 pages

Practicalmysql

The document provides SQL commands for creating a database named 'testDB' and a table called 'CUSTOMERS' with various fields. It includes examples of inserting multiple records into the 'CUSTOMERS' table. The syntax for database creation, selection, and table creation is also outlined.

Uploaded by

Nicholas kaburu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Practicalmysql

The document provides SQL commands for creating a database named 'testDB' and a table called 'CUSTOMERS' with various fields. It includes examples of inserting multiple records into the 'CUSTOMERS' table. The syntax for database creation, selection, and table creation is also outlined.

Uploaded by

Nicholas kaburu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Nicholas Muthugumi Kaburu.

ICT – 4 – 3861 – 21.

SQL - CREATE Database.

CREATE DATABASE testDB;


syntax: CREATE DATABASE cybersecurity;

SQL - SELECT Database, USE Statement


syntax: use cybersecurity;

show databases;
SQL - CREATE Table
syntax:
CREATE TABLE CUSTOMERS(
ID
INT
NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE NOT NULL,
INT
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);

SQL - INSERT Query

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (1, 'Ramesh', 32, 'Ahmedabad', 2000.00 );
INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (2, 'Khilan', 25, 'Delhi', 1500.00 );

syntax: INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (3, 'kaushik', 23, 'Kota', 2000.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (4, 'Chaitali', 25, 'Mumbai', 6500.00 );
INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (5, 'Hardik', 27, 'Bhopal', 8500.00 );

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)


VALUES (6, 'Komal', 22, 'MP', 4500.00 );

the overall table now.

You might also like