SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
SQL
Database and Management System
By Manish
SQL
BASIS
COMMANDS
CREATE COMMAND:
1. EMPLOYEE TABLE:
CREATE TABLE EMPLOYEE
(
Fname varchar(15) not null,
Minitchar,
Lname varchar(15) not null,
ssn char(9) not null primarykey,
Bdate Date,
Addressvarchar(30),
Sex char,
Salarynumber,
Super_ssnchar(9) notnull ,
Dnoint
);
2. DEPARTMENT TABLE:
CREATE table department
(
Dname varchar(15) not null,
DnumberINTegernotnull PRIMARYKEY,
mgr_ssn char(9) not null,
mrg_start_date date
);
3. DEPT_LOCATION TABLE:
CREATE TABLE DEPT_LOCATION (
DnumberintegernotnulL,
Dlocationvarchar(15) not null,
PRIMARYKEY(Dnumber,Dlocation) );
4. WORKS_ON TABLE:
CREATE TABLE WORKS_ON
(
Essnchar(9) not null,
PnoINt,
hoursnumber,
PRIMARYKEY(ESSN,PNO)
);
5. PROJECT TABLE:
CREATE TABLE PROJECT
(
Pname varchar(10) not null,
PnumberINTnotnull PRIMARY KEY,
Plocationvarchar(15),
DmunINT
);
6. DEPENDENT TABLE:
CREATE TABLE DEPENDENT
(
Essn char(9) notnull,
Dependent_namevarchar(15) notnull PRIMARY KEY,
Sex char ,
Bdate time,
Relationshipvarchar(10)
);
INSERT COMMAND:
INSERTING TUPLES INTO EMPLOYEE TABLE:
1. INSERT INTO EMPLOYEE VALUES (‘John’,’B’,’Smith’,’123456789’,’1965-01-09’,’731 Fondren, Houston,
TX’,’M’,30000,333445555,5)
2. INSERT INTO EMPLOYEE VALUES (‘Franklin’,’T’,’Wong’,333445555’,’1955-13-08’,’638 Voss,Houston,
TX’,’M’,40000,888665555,5)
3. INSERT INTO EMPLOYEE VALUES (‘Alicia’,’J’,’Zelaya’,’999887777’,’1968-01-19’,’3321 Castle,Spring,
TX’,’F’,25000,987654321,4)
4. INSERT INTO EMPLOYEE VALUES (‘Jennifer’,’S’,’Wallace’,’987654321’,’1941-06-20’,’291 Berry,Bellaire,
TX’,’F’,43000,888665555,4)
5. INSERT INTO EMPLOYEE VALUES (‘Ramesh’,’K’,’Narayan’,’666884444’,’1962-09-15’,’975 FireOak, Humble,
TX’,’M’,38000,333445555,5)
6. INSERT INTO EMPLOYEE VALUES (‘Joyce’,’A’,’English’,’453453453’,’1972-07-31’,’5631 Rice
,Houston,TX’,’F’,25000,333445555,5)
7. INSERT INTO EMPLOYEE VALUES (‘Ahmed’,’V’,’Jabbar’,’987987987’,’1969-03-29’,’980 Dallas,Houston,
TX’,’M’,25000,987654321,4)
8. INSERT INTO EMPLOYEE VALUES (‘James’,’E’,’Borg’,’888665555’,’1937-11-10’,’450 Stone, Houston,
TX’,’M’,55000,NULL,1)
EMPLOYEE
Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno
Ahmad V Jabbar 987987987 29-Mar-69 980,Dallas Houstontx M 25000 987654321 4
Alicia J Zelaya 999887777 19-Jan-68 3321 castle,springtx F 25000 987654321 4
FranklinT Wong 333445555 08-Dec-55 638 voss,Houstontx M 40000 888665555 5
James E Borg 888665555 10-Nov-37 450 Stone ,Houstontx M 55000 1
JenniferS Wallace 987654321 20-Jun-41 291 berry,Bellaire,tx F 43000 888665555 4
John B Smith 123456789 09-Jan-65 731 Fondren,Houston,TX M 30000 333445555 5
Joyce A English 453453453 31-Jul-72 5631 Rice,Houstontx F 25000 333445555 5
RameshK Narayan 666884444 15-Sep-62 975,Fire Oak ,Humble,tx M 38000 333445555 5
INSERTING TUPLES INTO DEPARTMENT TABLE:
1. INSERT INTO DEPARTMENT VALUES (‘Research’,5,333445555,’1988-05-22’)
2. INSERT INTO DEPARTMENT VALUES (‘Administration’,4,987654321,’1995-01-01’)
3. INSERT INTO DEPARTMENT VALUES (‘Headquarters’1,888665555,’1981-06-19’)
DEPARTMENT
Dname Dnumber Mgr_ssn Mgr_start_date
RESEARCH 1 888665555 19-Jun-81
Administration 4 987654321 01-Jan-95
Research 5 333445555 22-May-88
INSERTING TUPLES INTO DEPT_LOCATIONS TABLE:
1. INSERT INTO DEPT_LOCATIONS VALUES (1,’Houston’)
2. INSERT INTO DEPT_LOCATIONS VALUES (4,’Stafford’)
3. INSERT INTO DEPT_LOCATIONS VALUES (5,’Bellaire’)
4. INSERT INTO DEPT_LOCATIONS VALUES (5,’Sugarland’)
5. INSERT INTO DEPT_LOCATIONS VALUES (5,’Houston’)
INSERTING TUPLES INTO WORKS_ON TABLE:
1. INSERT INTO WORKS_ON VALUES(123456789,1,32.5)
2. INSERT INTO WORKS_ON VALUES(123456789,2,7.5)
3. INSERT INTO WORKS_ON VALUES(666884444,3,40.0)
4. INSERT INTO WORKS_ON VALUES(453453453,1,20.0)
5. INSERT INTO WORKS_ON VALUES(453453453,2,20.0)
6. INSERT INTO WORKS_ON VALUES(333445555,2,10.0)
7. INSERT INTO WORKS_ON VALUES(333445555,3,10.0)
8. INSERT INTO WORKS_ON VALUES(333445555,10,10.0)
9. INSERT INTO WORKS_ON VALUES(333445555,20,10.0)
10. INSERT INTO WORKS_ON VALUES(999887777,30,30.0)
11. INSERT INTO WORKS_ON VALUES(999887777,10,10.0)
12. INSERT INTO WORKS_ON VALUES(987987987,10,10.0)
13. INSERT INTO WORKS_ON VALUES(987987987,30,5.0)
14. INSERT INTO WORKS_ON VALUES(987654321,30,20.0)
15. INSERT INTO WORKS_ON VALUES(987654321,20,15.0)
16. INSERT INTO WORKS_ON VALUES(888665555,20,NULL)
INSERTING TUPLES INTO PROJECT TABLE:
1. INSERT INTO PROJECT VALUES(‘ProductX’,1,’Bellaire’,5)
2. INSERT INTO PROJECT VALUES(‘ProductY’,2,’Sugarland’,5)
3. INSERT INTO PROJECT VALUES(‘ProductZ’,3,’Houston’,5)
4. INSERT INTO PROJECT VALUES(‘Computerization’,10,’Stafford’,4)
5. INSERT INTO PROJECT VALUES(‘Reorganization’,20,’Houston’,1)
6. INSERT INTO PROJECT VALUES(‘Newbenefits’30,’Stafford’,4)
PROJECT
Pname Pnumber Plocation Dnum
ProductX 1 Bellaire 5
ProductY 2 Sugarland 5
ProductZ 3 Houston 5
Computerization 10 Stafford 4
Reorganization 20 Houston 1
Newbenefits 30 Stafford 4
DEPT_LOCATION
Dnumber Dlocation
1 Houston
4 Stafford
5 Bellaire
5 Houston
5 Sugarland
WORKS_ON
Essn Pno Hours
123456789 1 32
123456789 2 7.5
666884444 3 40
435453453 1 20
435453453 2 20
333445555 2 10
333445555 3 10
333445555 10 10
333445555 10 10
333445555 20 10
999887777 30 30
999887777 10 10
987987987 10 35
987987987 30 5
987654321 30 20
987654321 20 15
888665555 20
INSERTING TUPLES INTO DEPENDENT TABLE:
1. INSERT INTO DEPENDENT VALUES(‘333445555’,’Alice’,’F’,’1986-04-05’,’Daughter’)
2. INSERT INTO DEPENDENT VALUES(‘333445555’,’Theodore’,’M’,’1983-10-25’,’Son’)
3. INSERT INTO DEPENDENT VALUES(‘333445555’,’Joy’,’F’,’1958-05-03’,’Spouse’)
4. INSERT INTO DEPENDENT VALUES(‘987654321’,’Abner’,’1942-02-28’,’Spouse’)
5. INSERT INTO DEPENDENT VALUES(‘123456789’,’Michael’,’1988-01-04’,’Son’)
6. INSERT INTO DEPENDENT VALUES(‘123456789’,’Alice’,’F’,’1988-12-30’,’Daughter’)
7. INSERT INTO DEPENDENT VALUES(‘123456789’,’Elizabeth’,’F’,’1967-05-05’,’Spouse’)
DEPENDENT
Essn Dependent_name Sex Bdate Relationship
333445555 Alice F 05-Apr-86 Daughter
333445555 Theodore M 25-Oct-83 Son
333445555 Joy F 03-May-58 Spouse
987654321 Abner M 28-Feb-42 Spouse
123456789 Michael M 04-Jan-88 Son
123456789 Alice F 30-Dec-88 Daughter
123456789 Elizabeth F 05-May-67 Spouse
DELETE COMMAND:
1. DELETE FROM PROJECT
WHERE Pname=’ProductX’
2. DELETE FROM PROJECT
WHERE Pnumber=3
UPDATE COMMAND:
1. UPDATE DEPARTMENT
SET Dname=’Research’
WHERE Dnum=1
PROJECT
Pname Pnumber Plocation Dnum
#Deleted #Deleted
ProductY 2 Sugarland 5
#Deleted #Deleted
Computerization 10 Stafford 4
Reorganisation 20 Houston 1
Newbenefits 30 Stafford 4
DEPARTMENT
Dname Dnumber Mgr_ssn Mgr_start_date
Research 1 888665555 19-Jun-81
Administration 4 987654321 01-Jan-95
Research 5 333445555 22-May-88
Q1. Retrieve the birthdate andaddressof the employeewhose name is‘JohnBSmith’.
SELECT Bdate ,Address
FROM EMPLOYEE
WHERE Fname='john'ANDLname='Smith'
Q2. Retrieve the name andaddressof the all employee whoworkforthe ‘Research’Department.
SELECT Fname ,Minit,Address
FROM EMPLOYEE,DEPARTMENT
WHERE Dname='RESEARCH'AND Dnumber=Dno
Q3.For everyprojectlocatedinthe ‘Stafford’,listthe projectnumber,the controllingdepartment
numberandthe departmentmanagerlastname ,addressandbirthdate.
SELECT Pnumber,Dnum,Lname,Address,Bdate
FROM PROJECT,DEPARTMENT,EMPLOYEE
WHERE project.dnum=department.dnumberand
department.mgr_ssn=employee.ssnand
project.plocation='Stafford'
Q4.For each employeeretrieve the employeefirstandlastname andthe firstand last name of hisor her
immediate supervisior.
SELECT E1.Fname,E1.Lname ,E2.Fname ASSupervisior_Fname,E2.LnameasSupervisior_Lname
FROM EMPLOYEE ASE1,EMPLOYEE AS E2
WHERE E1.super_ssn=E2.ssn
Q1
Bdate Address
09-Jan-65 731 Fondren Houston,TX
Q2
Fname Minit Lname Address
John B Smith 731 FondrenHouston, TX
Franklin T Wong 638 Voss,Houston,TX
Joyce A English 5631 Rice,Houston,TX
Ramesh K Narayan 975,Fire Oak ,Humble,TX
Q3
Pnumber Dnum Lname Address Bdate
10 4 Wallace 291 Berry,Bellaire, TX 20-Jun-41
30 4 Wallace 291 Berry,Bellaire,TX 20-Jun-41
Q4
Fname Lname Supervisior_Fname Supervisior_Lname
John Smith Franklin Wong
Joyce English Franklin Wong
RameshNarayan Franklin Wong
FranklinWong James Borg
JenniferWallace James Borg
Ahmad Jabbar Jennifer Wallace
Alicia Zelaya Jennifer Wallace
Q5.Make a listof the all projectnumberforprojectsthat involve anemployeewhoselastname is
‘Smith’eitherasa workeroras Manager of the departmentthatcontrolsthe projects.
(SELECT DISTINCT Pnumber
FROM PROJECT,DEPARTMENT,EMPLOYEE
WHERE Dnum=Dnumberandmgr_ssn=ssnandLname='Smith')
UNION
(SELECT DISTINCTPnumber
FROM PROJECT,WORKS_ON ,EMPLOYEE
WHERE Pnumber=Pnoand Essn=ssnand Lname='Smith')
Q6.Retrieve all the employeewhose AddressisinHoustonTexas.
SELECT Fname,Minit,Lname,Address
FROM EMPLOYEE
WHERE AddressLike '*Houston*'
Q7.Findall employee whowere bornduring1955’s.
SELECT Fname,Lname,Bdate
FROM EMPLOYEE
WHERE year(bdate)='1955'
Q8.Showthe increasedsalariesif everyemployeeworkingon‘ProductX’projectisgivena10 percent
raise.
SELECT Fname,Minit,Lname,1.1*SalaryasIncreased_Salary
FROM EMPLOYEE,WORKS_ON,PROJECT
WHERE ssn=Essnand Pno=PnumberandPname ='ProductX'
Q9.Retrieve all employee indepartment5whose salaryisb/w $30000 and $40000.
SELECT Fname ,Minit,Lname,Salary
FROM EMPLOYEE
WHERE salarybetween30000 and 40000
Q5
Pnumber
1
2
Q6
Fname Minit Lname Address
John B Smith 731 FondrenHouston,TX
Franklin T Wong 638 Voss,Houston,TX
Joyce A English 5631 Rice, Houston,TX
James E Borg 450 Stone ,Houston,TX
Ahmad V Jabbar 980,Dallas Houston,TX
Q7
Fname Lname Bdate
FranklinWong 08-Dec-55
Q8
Fname Minit Lname Increased_Salary
John B Smith 33000
Q9
Fname Minit Lname Salary
John B Smith 30000
Franklin T Wong 40000
Ramesh K Narayan 38000
Q10.Retrieve the name of the employee andhissalarywhoisearningMaximum.
SELECT MAX(Salary) as[Max_sal]
FROM EMPLOYEE
Q11.Retrieve the salaryof the 2nd
Highestearningemployeeandit’sname.
SELECT Fname,Minit,Lname,salary
FROM EMPLOYEE
WHERE Salary=(SELECTMAX(salary) FROMemployee WHEREsalary<(SELECT MAX(salary) FROM
employee ))
Q12.Retrieve alistof the employeeandthe Projectstheyare workingonorderedbydepartmentand
withindepartmentorderedbythe alphabeticallybylastname thenfirstname.
SELECT Dname ,Lname ,Fname ,Pname
FROM EMPLOYEE,DEPARTMENT,PROJECT,WORKS_ON
WHERE Dnumber=dnoandssn=essnandpno=Pnumber
orderby dname ,Lname,Fname
Q10
Max_sal
55000
Q11
Fname Minit Lname salary
JenniferS Wallace 43000
Q12
Dname Lname Fname Pname
Administration Jabbar Ahmad Newbenefits
Administration Jabbar Ahmad Computerization
Administration Wallace Jennifer Newbenefits
Administration Wallace Jennifer Reorganisation
Administration Zelaya Alicia Newbenefits
Administration Zelaya Alicia Computerization
Headquarters Borg James Reorganisation
Research Narayan Ramesh ProductZ
Research Smith John ProductY
Research Smith John ProductX
Research Wong Franklin Reorganisation
Research Wong Franklin Computerization
Research Wong Franklin Computerization
Research Wong Franklin ProductZ
Research Wong Franklin ProductY

Weitere ähnliche Inhalte

Andere mochten auch

Oracle 10g Forms Lesson 6
Oracle 10g Forms Lesson  6Oracle 10g Forms Lesson  6
Oracle 10g Forms Lesson 6KAMA3
 
Oracle 10g Application Server
Oracle 10g Application ServerOracle 10g Application Server
Oracle 10g Application ServerMark J. Feldman
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2Mohd Tousif
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best PracticesAlwyn D'Souza
 
Treinamento Oracle Forms
Treinamento Oracle FormsTreinamento Oracle Forms
Treinamento Oracle FormsFelipe Goulart
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesSmitha Padmanabhan
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form materialRajesh Ch
 
Oracle forms developer 10g vol1
Oracle forms developer 10g vol1Oracle forms developer 10g vol1
Oracle forms developer 10g vol1abdull466
 
SQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseSQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseJeff Smith
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)magupta26
 
Oracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & TricksOracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & TricksJeff Smith
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projectsjwjablonski
 
Introduction to Oracle Financials
Introduction to Oracle FinancialsIntroduction to Oracle Financials
Introduction to Oracle Financialshasan2000
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questionsPyadav010186
 

Andere mochten auch (20)

Oracle 10g Forms Lesson 6
Oracle 10g Forms Lesson  6Oracle 10g Forms Lesson  6
Oracle 10g Forms Lesson 6
 
10g forms
10g forms10g forms
10g forms
 
Oracle 10g Application Server
Oracle 10g Application ServerOracle 10g Application Server
Oracle 10g Application Server
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best Practices
 
Treinamento Oracle Forms
Treinamento Oracle FormsTreinamento Oracle Forms
Treinamento Oracle Forms
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practices
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
 
forms builder
forms builderforms builder
forms builder
 
Oracle forms developer 10g vol1
Oracle forms developer 10g vol1Oracle forms developer 10g vol1
Oracle forms developer 10g vol1
 
SQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseSQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle Database
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)
 
Oracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & TricksOracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & Tricks
 
DBMS Practical File
DBMS Practical FileDBMS Practical File
DBMS Practical File
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projects
 
Oracle Complete Interview Questions
Oracle Complete Interview QuestionsOracle Complete Interview Questions
Oracle Complete Interview Questions
 
Introduction to Oracle Financials
Introduction to Oracle FinancialsIntroduction to Oracle Financials
Introduction to Oracle Financials
 
Best sql plsql material
Best sql plsql materialBest sql plsql material
Best sql plsql material
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
 

Kürzlich hochgeladen

Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxryandux83rd
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...HetalPathak10
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 

Kürzlich hochgeladen (20)

Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptx
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 

SQL commands

  • 1. SQL Database and Management System By Manish
  • 3. CREATE COMMAND: 1. EMPLOYEE TABLE: CREATE TABLE EMPLOYEE ( Fname varchar(15) not null, Minitchar, Lname varchar(15) not null, ssn char(9) not null primarykey, Bdate Date, Addressvarchar(30), Sex char, Salarynumber, Super_ssnchar(9) notnull , Dnoint ); 2. DEPARTMENT TABLE: CREATE table department ( Dname varchar(15) not null, DnumberINTegernotnull PRIMARYKEY, mgr_ssn char(9) not null, mrg_start_date date ); 3. DEPT_LOCATION TABLE: CREATE TABLE DEPT_LOCATION ( DnumberintegernotnulL, Dlocationvarchar(15) not null, PRIMARYKEY(Dnumber,Dlocation) );
  • 4. 4. WORKS_ON TABLE: CREATE TABLE WORKS_ON ( Essnchar(9) not null, PnoINt, hoursnumber, PRIMARYKEY(ESSN,PNO) ); 5. PROJECT TABLE: CREATE TABLE PROJECT ( Pname varchar(10) not null, PnumberINTnotnull PRIMARY KEY, Plocationvarchar(15), DmunINT ); 6. DEPENDENT TABLE: CREATE TABLE DEPENDENT ( Essn char(9) notnull, Dependent_namevarchar(15) notnull PRIMARY KEY, Sex char , Bdate time, Relationshipvarchar(10) );
  • 5. INSERT COMMAND: INSERTING TUPLES INTO EMPLOYEE TABLE: 1. INSERT INTO EMPLOYEE VALUES (‘John’,’B’,’Smith’,’123456789’,’1965-01-09’,’731 Fondren, Houston, TX’,’M’,30000,333445555,5) 2. INSERT INTO EMPLOYEE VALUES (‘Franklin’,’T’,’Wong’,333445555’,’1955-13-08’,’638 Voss,Houston, TX’,’M’,40000,888665555,5) 3. INSERT INTO EMPLOYEE VALUES (‘Alicia’,’J’,’Zelaya’,’999887777’,’1968-01-19’,’3321 Castle,Spring, TX’,’F’,25000,987654321,4) 4. INSERT INTO EMPLOYEE VALUES (‘Jennifer’,’S’,’Wallace’,’987654321’,’1941-06-20’,’291 Berry,Bellaire, TX’,’F’,43000,888665555,4) 5. INSERT INTO EMPLOYEE VALUES (‘Ramesh’,’K’,’Narayan’,’666884444’,’1962-09-15’,’975 FireOak, Humble, TX’,’M’,38000,333445555,5) 6. INSERT INTO EMPLOYEE VALUES (‘Joyce’,’A’,’English’,’453453453’,’1972-07-31’,’5631 Rice ,Houston,TX’,’F’,25000,333445555,5) 7. INSERT INTO EMPLOYEE VALUES (‘Ahmed’,’V’,’Jabbar’,’987987987’,’1969-03-29’,’980 Dallas,Houston, TX’,’M’,25000,987654321,4) 8. INSERT INTO EMPLOYEE VALUES (‘James’,’E’,’Borg’,’888665555’,’1937-11-10’,’450 Stone, Houston, TX’,’M’,55000,NULL,1) EMPLOYEE Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno Ahmad V Jabbar 987987987 29-Mar-69 980,Dallas Houstontx M 25000 987654321 4 Alicia J Zelaya 999887777 19-Jan-68 3321 castle,springtx F 25000 987654321 4 FranklinT Wong 333445555 08-Dec-55 638 voss,Houstontx M 40000 888665555 5 James E Borg 888665555 10-Nov-37 450 Stone ,Houstontx M 55000 1 JenniferS Wallace 987654321 20-Jun-41 291 berry,Bellaire,tx F 43000 888665555 4 John B Smith 123456789 09-Jan-65 731 Fondren,Houston,TX M 30000 333445555 5 Joyce A English 453453453 31-Jul-72 5631 Rice,Houstontx F 25000 333445555 5 RameshK Narayan 666884444 15-Sep-62 975,Fire Oak ,Humble,tx M 38000 333445555 5 INSERTING TUPLES INTO DEPARTMENT TABLE: 1. INSERT INTO DEPARTMENT VALUES (‘Research’,5,333445555,’1988-05-22’) 2. INSERT INTO DEPARTMENT VALUES (‘Administration’,4,987654321,’1995-01-01’) 3. INSERT INTO DEPARTMENT VALUES (‘Headquarters’1,888665555,’1981-06-19’) DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date RESEARCH 1 888665555 19-Jun-81 Administration 4 987654321 01-Jan-95 Research 5 333445555 22-May-88
  • 6. INSERTING TUPLES INTO DEPT_LOCATIONS TABLE: 1. INSERT INTO DEPT_LOCATIONS VALUES (1,’Houston’) 2. INSERT INTO DEPT_LOCATIONS VALUES (4,’Stafford’) 3. INSERT INTO DEPT_LOCATIONS VALUES (5,’Bellaire’) 4. INSERT INTO DEPT_LOCATIONS VALUES (5,’Sugarland’) 5. INSERT INTO DEPT_LOCATIONS VALUES (5,’Houston’) INSERTING TUPLES INTO WORKS_ON TABLE: 1. INSERT INTO WORKS_ON VALUES(123456789,1,32.5) 2. INSERT INTO WORKS_ON VALUES(123456789,2,7.5) 3. INSERT INTO WORKS_ON VALUES(666884444,3,40.0) 4. INSERT INTO WORKS_ON VALUES(453453453,1,20.0) 5. INSERT INTO WORKS_ON VALUES(453453453,2,20.0) 6. INSERT INTO WORKS_ON VALUES(333445555,2,10.0) 7. INSERT INTO WORKS_ON VALUES(333445555,3,10.0) 8. INSERT INTO WORKS_ON VALUES(333445555,10,10.0) 9. INSERT INTO WORKS_ON VALUES(333445555,20,10.0) 10. INSERT INTO WORKS_ON VALUES(999887777,30,30.0) 11. INSERT INTO WORKS_ON VALUES(999887777,10,10.0) 12. INSERT INTO WORKS_ON VALUES(987987987,10,10.0) 13. INSERT INTO WORKS_ON VALUES(987987987,30,5.0) 14. INSERT INTO WORKS_ON VALUES(987654321,30,20.0) 15. INSERT INTO WORKS_ON VALUES(987654321,20,15.0) 16. INSERT INTO WORKS_ON VALUES(888665555,20,NULL) INSERTING TUPLES INTO PROJECT TABLE: 1. INSERT INTO PROJECT VALUES(‘ProductX’,1,’Bellaire’,5) 2. INSERT INTO PROJECT VALUES(‘ProductY’,2,’Sugarland’,5) 3. INSERT INTO PROJECT VALUES(‘ProductZ’,3,’Houston’,5) 4. INSERT INTO PROJECT VALUES(‘Computerization’,10,’Stafford’,4) 5. INSERT INTO PROJECT VALUES(‘Reorganization’,20,’Houston’,1) 6. INSERT INTO PROJECT VALUES(‘Newbenefits’30,’Stafford’,4) PROJECT Pname Pnumber Plocation Dnum ProductX 1 Bellaire 5 ProductY 2 Sugarland 5 ProductZ 3 Houston 5 Computerization 10 Stafford 4 Reorganization 20 Houston 1 Newbenefits 30 Stafford 4 DEPT_LOCATION Dnumber Dlocation 1 Houston 4 Stafford 5 Bellaire 5 Houston 5 Sugarland WORKS_ON Essn Pno Hours 123456789 1 32 123456789 2 7.5 666884444 3 40 435453453 1 20 435453453 2 20 333445555 2 10 333445555 3 10 333445555 10 10 333445555 10 10 333445555 20 10 999887777 30 30 999887777 10 10 987987987 10 35 987987987 30 5 987654321 30 20 987654321 20 15 888665555 20
  • 7. INSERTING TUPLES INTO DEPENDENT TABLE: 1. INSERT INTO DEPENDENT VALUES(‘333445555’,’Alice’,’F’,’1986-04-05’,’Daughter’) 2. INSERT INTO DEPENDENT VALUES(‘333445555’,’Theodore’,’M’,’1983-10-25’,’Son’) 3. INSERT INTO DEPENDENT VALUES(‘333445555’,’Joy’,’F’,’1958-05-03’,’Spouse’) 4. INSERT INTO DEPENDENT VALUES(‘987654321’,’Abner’,’1942-02-28’,’Spouse’) 5. INSERT INTO DEPENDENT VALUES(‘123456789’,’Michael’,’1988-01-04’,’Son’) 6. INSERT INTO DEPENDENT VALUES(‘123456789’,’Alice’,’F’,’1988-12-30’,’Daughter’) 7. INSERT INTO DEPENDENT VALUES(‘123456789’,’Elizabeth’,’F’,’1967-05-05’,’Spouse’) DEPENDENT Essn Dependent_name Sex Bdate Relationship 333445555 Alice F 05-Apr-86 Daughter 333445555 Theodore M 25-Oct-83 Son 333445555 Joy F 03-May-58 Spouse 987654321 Abner M 28-Feb-42 Spouse 123456789 Michael M 04-Jan-88 Son 123456789 Alice F 30-Dec-88 Daughter 123456789 Elizabeth F 05-May-67 Spouse DELETE COMMAND: 1. DELETE FROM PROJECT WHERE Pname=’ProductX’ 2. DELETE FROM PROJECT WHERE Pnumber=3 UPDATE COMMAND: 1. UPDATE DEPARTMENT SET Dname=’Research’ WHERE Dnum=1 PROJECT Pname Pnumber Plocation Dnum #Deleted #Deleted ProductY 2 Sugarland 5 #Deleted #Deleted Computerization 10 Stafford 4 Reorganisation 20 Houston 1 Newbenefits 30 Stafford 4 DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date Research 1 888665555 19-Jun-81 Administration 4 987654321 01-Jan-95 Research 5 333445555 22-May-88
  • 8. Q1. Retrieve the birthdate andaddressof the employeewhose name is‘JohnBSmith’. SELECT Bdate ,Address FROM EMPLOYEE WHERE Fname='john'ANDLname='Smith' Q2. Retrieve the name andaddressof the all employee whoworkforthe ‘Research’Department. SELECT Fname ,Minit,Address FROM EMPLOYEE,DEPARTMENT WHERE Dname='RESEARCH'AND Dnumber=Dno Q3.For everyprojectlocatedinthe ‘Stafford’,listthe projectnumber,the controllingdepartment numberandthe departmentmanagerlastname ,addressandbirthdate. SELECT Pnumber,Dnum,Lname,Address,Bdate FROM PROJECT,DEPARTMENT,EMPLOYEE WHERE project.dnum=department.dnumberand department.mgr_ssn=employee.ssnand project.plocation='Stafford' Q4.For each employeeretrieve the employeefirstandlastname andthe firstand last name of hisor her immediate supervisior. SELECT E1.Fname,E1.Lname ,E2.Fname ASSupervisior_Fname,E2.LnameasSupervisior_Lname FROM EMPLOYEE ASE1,EMPLOYEE AS E2 WHERE E1.super_ssn=E2.ssn Q1 Bdate Address 09-Jan-65 731 Fondren Houston,TX Q2 Fname Minit Lname Address John B Smith 731 FondrenHouston, TX Franklin T Wong 638 Voss,Houston,TX Joyce A English 5631 Rice,Houston,TX Ramesh K Narayan 975,Fire Oak ,Humble,TX Q3 Pnumber Dnum Lname Address Bdate 10 4 Wallace 291 Berry,Bellaire, TX 20-Jun-41 30 4 Wallace 291 Berry,Bellaire,TX 20-Jun-41 Q4 Fname Lname Supervisior_Fname Supervisior_Lname John Smith Franklin Wong Joyce English Franklin Wong RameshNarayan Franklin Wong FranklinWong James Borg JenniferWallace James Borg Ahmad Jabbar Jennifer Wallace Alicia Zelaya Jennifer Wallace
  • 9. Q5.Make a listof the all projectnumberforprojectsthat involve anemployeewhoselastname is ‘Smith’eitherasa workeroras Manager of the departmentthatcontrolsthe projects. (SELECT DISTINCT Pnumber FROM PROJECT,DEPARTMENT,EMPLOYEE WHERE Dnum=Dnumberandmgr_ssn=ssnandLname='Smith') UNION (SELECT DISTINCTPnumber FROM PROJECT,WORKS_ON ,EMPLOYEE WHERE Pnumber=Pnoand Essn=ssnand Lname='Smith') Q6.Retrieve all the employeewhose AddressisinHoustonTexas. SELECT Fname,Minit,Lname,Address FROM EMPLOYEE WHERE AddressLike '*Houston*' Q7.Findall employee whowere bornduring1955’s. SELECT Fname,Lname,Bdate FROM EMPLOYEE WHERE year(bdate)='1955' Q8.Showthe increasedsalariesif everyemployeeworkingon‘ProductX’projectisgivena10 percent raise. SELECT Fname,Minit,Lname,1.1*SalaryasIncreased_Salary FROM EMPLOYEE,WORKS_ON,PROJECT WHERE ssn=Essnand Pno=PnumberandPname ='ProductX' Q9.Retrieve all employee indepartment5whose salaryisb/w $30000 and $40000. SELECT Fname ,Minit,Lname,Salary FROM EMPLOYEE WHERE salarybetween30000 and 40000 Q5 Pnumber 1 2 Q6 Fname Minit Lname Address John B Smith 731 FondrenHouston,TX Franklin T Wong 638 Voss,Houston,TX Joyce A English 5631 Rice, Houston,TX James E Borg 450 Stone ,Houston,TX Ahmad V Jabbar 980,Dallas Houston,TX Q7 Fname Lname Bdate FranklinWong 08-Dec-55 Q8 Fname Minit Lname Increased_Salary John B Smith 33000 Q9 Fname Minit Lname Salary John B Smith 30000 Franklin T Wong 40000 Ramesh K Narayan 38000
  • 10. Q10.Retrieve the name of the employee andhissalarywhoisearningMaximum. SELECT MAX(Salary) as[Max_sal] FROM EMPLOYEE Q11.Retrieve the salaryof the 2nd Highestearningemployeeandit’sname. SELECT Fname,Minit,Lname,salary FROM EMPLOYEE WHERE Salary=(SELECTMAX(salary) FROMemployee WHEREsalary<(SELECT MAX(salary) FROM employee )) Q12.Retrieve alistof the employeeandthe Projectstheyare workingonorderedbydepartmentand withindepartmentorderedbythe alphabeticallybylastname thenfirstname. SELECT Dname ,Lname ,Fname ,Pname FROM EMPLOYEE,DEPARTMENT,PROJECT,WORKS_ON WHERE Dnumber=dnoandssn=essnandpno=Pnumber orderby dname ,Lname,Fname Q10 Max_sal 55000 Q11 Fname Minit Lname salary JenniferS Wallace 43000 Q12 Dname Lname Fname Pname Administration Jabbar Ahmad Newbenefits Administration Jabbar Ahmad Computerization Administration Wallace Jennifer Newbenefits Administration Wallace Jennifer Reorganisation Administration Zelaya Alicia Newbenefits Administration Zelaya Alicia Computerization Headquarters Borg James Reorganisation Research Narayan Ramesh ProductZ Research Smith John ProductY Research Smith John ProductX Research Wong Franklin Reorganisation Research Wong Franklin Computerization Research Wong Franklin Computerization Research Wong Franklin ProductZ Research Wong Franklin ProductY