SQL

How to create a table using SQL and insert values into it

Hello there,

In this post, I will explain how to create the following table using SQL commands.

Assignment: 

Create a table Clients and insert the following values:

Input Table Client: 

Name Age Sex Doj City Salary
Mohamed 30 M 2021-09-01 Tunis 5000
Salah 25 M 2021-08-01 Cairo 3000
Emna 30 F 2021-05-01 Cairo 5000
foued 22 M 2020-09-01 Tunis 5000
ALi 45 M 2019-05-01 Rabat 5000

 

SQL commands:

Create table clients (Name varchar(25), Age int, Sex char(1),
doj date, city varchar(25), salary float);

Insert into Clients values (‘Mohamed’, 30, ‘M’, ‘2021-09-01’, ‘Tunis’, 5000),
(‘Salah’, 25, ‘M’, ‘2021-08-01’, ‘Cairo’, 3000),
(‘Emna’, 30, ‘F’, ‘2021-05-01’, ‘Cairo’, 5000),
(‘foued’, 22, ‘M’, ‘2020-09-01’, ‘Tunis’, 5000),
(‘ALi’, 45, ‘M’, ‘2019-05-01’, ‘Rabat’, 5000);

Select * from Clients;

Download SQL commands

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button