0% found this document useful (0 votes)
10 views3 pages

SQL1

sql exaple

Uploaded by

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

SQL1

sql exaple

Uploaded by

Ahmad Hazem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL Structured Query Language

To Access and manipulate Data base

Create table

Create table table_Name (


Column1 datatype,
Clo2 datatype,
…..
Col datatype
);
Data type :
Text, int ,date,varchar(255),…

CREATE TABLE employee (


EmpID int primary key,
LastName varchar(255),
FirstName varchar(255),
Age int ,
Email varchar(255),
Address varchar(255),
City varchar(255)
);

2) Add Bdate column to employee

Alter table employee


Add Bdate date;
3) alter table_ Drop column
Alter table employee
Drop column City ;

4) alter table – alter /modify col


Alter table employee
Alter column age date;
Relationship
1 to many
Employee Manager
Create table manager(
ManID int primary key,
Location text ,
Mname text,
EMPID int,
Foreign key (EMPID) references employee(EmpID));
Many – many
Employee Project
Create table Project (
Pno int primary key ,
PName text
);

Create table join(


EmpID int,
Foreign key (EmpID)references employee(EmpID),
PNO int ,
Foreign key (PNO)references Project (Pno)
);

You might also like