Structured Query Language Name:
André Botha 22320165
The HR department of company ABC manages their staff by means of various data tables. The following table is an excerpt for a table named Employees. The column headings in the table correspond to the field names in the data table. Surname Botha Visagie Mbati Sepeng Ras 1
Initials SG P DF KJ LG
Gender Male Male Female Male Female
Write two different SQL statements to list the surnames, initials and the gender of all the employees in the data table. SELECT * FROM Employees; SELECT [Surname],[Initials],[Gender] FROM Employees;
2
Write a SQL statement to list the surnames and initials of all the employees in the data table. SELECT [Surname],[Initials] FROM Employees;
3
Write two different SQL statements to list the surnames, initials and gender for all the male employees. SELECT [Surname],[Initials],[Gender] FROM Employees WHERE [Gender] =’Male’; SELECT * FROM Employees WHERE [Gender] =’Male’;
4
Write two different SQL statements to list the surnames, initials and gender for all the female employees. SELECT [Surname],[Initials],[Gender] FROM Employees WHERE [Gender] =’Female’; SELECT * FROM Employees WHERE [Gender] =’Female’;
5
Write a SQL statement to list the surname, initials and the gender for employee Mbati in the data table. SELECT * FROM Employees WHERE [Surname] =’Mbati’;