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

Pelayo, Leiza Linda L. SQL Quizv2: Graduate School Score

The document describes a SQL quiz that tests skills in database creation, data manipulation, and querying. It provides the schema for an EMPLOYEE table with sample data and 25 questions to write SQL statements for tasks like creating the table, inserting records, selecting records by criteria, ordering results, and deleting records. The questions cover skills like filtering on columns, using comparison and pattern matching operators, aggregation, ordering, and joining tables.
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)
438 views3 pages

Pelayo, Leiza Linda L. SQL Quizv2: Graduate School Score

The document describes a SQL quiz that tests skills in database creation, data manipulation, and querying. It provides the schema for an EMPLOYEE table with sample data and 25 questions to write SQL statements for tasks like creating the table, inserting records, selecting records by criteria, ordering results, and deleting records. The questions cover skills like filtering on columns, using comparison and pattern matching operators, aggregation, ordering, and joining tables.
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

Pelayo, Leiza Linda L.

SQL QuizV2

GRADUATE SCHOOL SCORE

I. DATABASE CREATION & MANIPULATION.


Specific Instructions: Given the following relational structure where EmployeeId
serves as the primary key, write the correct SQL statements to generate specifications;

DATABASE NAME – BSIT3B / BSIT3A


TABLE NAME – EMPLOYEE
EmployeeI LastName FirstName Gender BirthDate CivilStat
d
1612345 Hansen Yolanda Female March 2, Married
2012
1612346 Svendson Tove Male December Single
3, 2000
1612347 Pettersen Korina Female August 5, Widowed
1997
1612348 Nilsen Tom Male February Married
7, 2008

1. – 5. Create the EMPLOYEE table. (Code View)

CREATE TABLE EMPLOYEE (


EmployeeId int,
LastName varchar (50),
FirstName varchar (50),
Gender varchar (50),
BirthDate varchar (50),
CivilStat varchar (50)
);

6. – 10. Add 4 records as indicated. (Code View)

INSERT INTO EMPLOYEE (‘EmployeeId’ , ‘LastName’ , ‘FirstName’ , ‘Gender’ ,


‘BirthDate’ , ‘CivilStat’) VALUES (‘1612345’ , ‘Hansen’ , ‘Yolanda’ , ‘Female’ ,
‘March 2, 2012’ , ‘Married’) , (‘1612346’ , ‘Svendson’ , ‘Tove’ , ‘Male’ ,
‘December 3, 2000’ , ‘Single’) , (‘1612347’ , ‘Pettersen’ , ‘Korina’ , ‘Female’ ,
‘August 5, 1997’ , ‘Widowed’) , (‘1612348’ , ‘Nilsen’ , ‘Tom’ , ‘Male’ ,
‘February 7, 2008’ , ‘Married’)

11. Display date of birth of “Hansen, Yolanda”.

SELECT BirthDate FROM EMPLOYEE WHERE LastName=”Hansen” AND


FirstName=”Yolanda’;
Pelayo, Leiza Linda L.
SQL QuizV2

12. Display records with “Single” as CivilStat.

SELECT * FROM EMPLOYEE WHERE CivilStat = ‘Single’

13. Display unique values for gender.

SELECT DISTINCT Gender FROM EMPLOYEE;

14. Display all records arranged in ascending order based on LastName.

SELECT * FROM EMPLOYEE ORDER BY LastName;

15. Display all records arranged in descending order based on EmployeeId.

SELECT * FROM EMPLOYEE ORDER BY EmployeeId DESC;

16. Display last name of records with first name starting with “T”.

SELECT LastName FROM EMPLOYEE WHERE FirstName LIKE ‘T%’

17. Display EmployeeId of records with “Married” as CivilStat.

SELECT EmployeeID FROM EMPLOYEE WHERE CivilStat= ‘Married’

18. Display civil status of EmployeeId “1612346”.

SELECT CivilStat FROM EMPLOYEE WHERE EmployeeID= ‘1612346’

19. Delete the record with EmployeeId “1612349”.

DELETE FROM EMPLOYEE WHERE EmployeeId = ‘16112349’

20. Display records with FirstName ending in “a”.

SELECT * FROM EMPLOYEE WHERE FirstName LIKE ‘%a’

21. Display EmployeeID of records with “Female” as Gender and “Single” as


CivilStat.

SELECT EmployeeID FROM EMPLOYEE WHERE Gender = ‘Female’ AND


CivilStat = ‘Single’

22. Display FirstName of records with “Widowed” as CivilStat.

SELECT FirstName FROM EMPLOYEE WHERE CivilStat = ‘Widowed’

23. Display BirthDate of EmployeeID “1612348”.

SELECT BirthDate FROM EMPLOYEE WHERE EmployeeId = ‘1612348’


Pelayo, Leiza Linda L.
SQL QuizV2

24. Display records with FirstName ending in “M” and LastName starting with “N”.
SELECT * FROM EMPLOYEE WHERE FirstName LIKE ‘%M’ AND LastName
LIKE ‘N%’

25. Display EmployeeID of “Single” or “Married” employees.

SELECT EmployeeId FROM EMPLOYEE WHERE CivilStat = ‘Single’ OR


CivilStat = ‘Married’

You might also like