0% found this document useful (0 votes)
24 views

SQL Statments

Uploaded by

Dohndeal Ocampo
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)
24 views

SQL Statments

Uploaded by

Dohndeal Ocampo
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/ 2

1.

SQL statement to select all employees with an Fname starting with "j":
SELECT * FROM employee
WHERE Fname LIKE ‘j%’;
2. SQL statement to select all employees with an Lname ending with "g":
SELECT * FROM employee
WHERE Lname LIKE ‘%g’;
3. SQL statement to select all employees with an Address that have "as" in any position:
SELECT * FROM employee
WHERE Address LIKE ‘%as%’;
4. SQL statement to select all employees with an Address that have "e" in the second position:
SELECT * FROM employee
WHERE Address LIKE ‘_e%’;
5. SQL statement to select all employees with an Fname that starts with "b" and are at least 3
characters in length:
SELECT * FROM employee
WHERE Fname LIKE ‘b_ _ _%’;
6. SQL statement to select all employees with an Fname that starts with "b" and ends with "e":
SELECT * FROM employee
WHERE Fname LIKE ‘b%e’;
7. SQL statement to select all employees with an Address that does NOT start with "f":
SELECT * FROM employee
WHERE Address NOT LIKE ‘f%’;
8. SQL statement to select all employees with an Fname starting with "e":
SELECT * FROM employee
WHERE Fname LIKE ‘e%’;
9. SQL statement to select all employees with an Lname ending with "c":
SELECT * FROM employee
WHERE Lname LIKE ‘%c’;
10. SQL statement to select all employees with an Address that have "if" in any position:
SELECT * FROM employee
WHERE Address LIKE ‘%if%’;
11. SQL statement to select all employees with an Address that have "t" in the second position:
SELECT * FROM employee
WHERE Address LIKE ‘_t%’;
12. SQL statement to select all employees with an Fname that starts with "c" and are at least 3
characters in length:
SELECT * FROM employee
WHERE Fname LIKE ‘c_ _ _%’;
13. SQL statement to select all employees with an Fname that starts with "w" and ends with "e":
SELECT * FROM employee
WHERE Fname LIKE ‘w%e’;
14. SQL statement to select all employees with an Address that does NOT start with "k":
SELECT * FROM employee
WHERE Address NOT LIKE ‘k%’;
15. SQL statement to display distinct values of SSN of all male employees.
SELECT DISTINCT (Ssn) FROM employee
WHERE Sex = ‘M’;
16. SQL statement to display distinct values of SSN of all female employees.
SELECT DISTINCT (Ssn) FROM employee
WHERE Sex = ‘F’;
17. SQL statement to display distinct values of SSN of all employees.
SELECT DISTINCT (Ssn) FROM employee;
18. SQL statement to display the total salary of all employees.
SELECT SUM (Salary)
FROM employee;
19. SQL statement to count all employees.
SELECT COUNT (Ssn)
FROM employee:
20. SQL statement to count all female and male employees.
SELECT COUNT (Sex) FROM Employee WHERE Sex = ‘F’ and Sex = ‘M’;

You might also like