Uploaded by Joie Rei

Programming SQL & PHP

advertisement
SQL _PHP Activities
ACTIVITY 12
1. Created TABLE named “LastName”
2. Created TABLE
3. Fill out the TABLE.
4. SELECT
FirstName AS WorkerName FROM worker
5. SELECT
FirstName, UPPER(FirstName) FROM worker
6. SELECT
DISTINCT Department FROM worker
7. SELECT SUBSTRING(FirstName, 1, 3) AS ExtractString FROM Worker
8. SELECT
9.
POSITION("a" IN "FirstName") FROM Worker
SELECT RTRIM('John Mynard ') AS RightTrimmedString FROM worker
10. SELECT
LTRIM(' John Mynard') AS LeftTrimmedString FROM worker
11.
SELECT DISTINCT(Department), LENGTH(Department) AS LengthOfName FROM worker
12. SELECT
UCASE(FirstName) AS UppercaseFirstName FROM worker
13. SELECT CONCAT(FirstName, " ", LastName) AS COMPLETE_NAME FROM worker
14. SELECT * FROM Worker ORDER BY FirstName
15. SELECT
* FROM worker ORDER BY FirstName ASC, Department DESC.
16. SELECT
* FROM Worker WHERE FirstName='Vipul' OR FirstName='Satish'
17. SELECT
* FROM `Worker` WHERE Department='Admin'
18. SELECT
19.
* FROM `Worker` WHERE Firstname LIKE '%a%'
SELECT * FROM `Worker` WHERE Firstname LIKE '%a'
20. SELECT
* FROM `Worker` WHERE Firstname LIKE '%h' AND FirstName<=6
Download