0% found this document useful (0 votes)
4 views12 pages

Dilanfroiland Act2sql

The document outlines a series of SQL activities categorized into sections focusing on basic queries, data manipulation, aggregate functions, wildcards, grouping, and advanced queries. It includes tasks such as selecting students, inserting and updating records, counting students per department, and filtering results based on specific criteria. Each section presents practical exercises to reinforce SQL skills and database management concepts.

Uploaded by

Computer Games
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Dilanfroiland Act2sql

The document outlines a series of SQL activities categorized into sections focusing on basic queries, data manipulation, aggregate functions, wildcards, grouping, and advanced queries. It includes tasks such as selecting students, inserting and updating records, counting students per department, and filtering results based on specific criteria. Each section presents practical exercises to reinforce SQL skills and database management concepts.

Uploaded by

Computer Games
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Froiland R.

Dilan

IT-201

Activity 2 – DCSN05C

Section A – Basic SQL Queries (SELECT, WHERE, ORDER BY, DISTINCT)

1. Show all students.

2. List distinct departments.


3. Show students in 3rd year, ordered by name.

4. Find students in 'Computer Science' and in 4th year.


5. Show students who are either in 'IT' or 2nd year.

6. Show students not in 'Engineering'.


Section B – Insert, Update, Delete, Nulls

7. Insert a new student named "Anna Reyes", 2nd year, 'Accountancy'.

8. Update her department to 'Business Admin'.


9. Delete her record.

10. Show students with NULL YearLevel (if any).


Section C – Aggregate Functions (SUM, AVG, COUNT, MIN, MAX)

11. Count how many students per department.

12. Show the minimum and maximum YearLevel.


13. Find average YearLevel.

14. Count all students.


Section D – Wildcards, LIKE, BETWEEN, IN

15. Find books with 'Data' in the title.

16. List students whose names start with 'J'.


17. Show students in departments IN ('IT', 'CS', 'SE').

18. Show books with BookID BETWEEN 5 AND 10


Section E – Grouping and Filtering

19. Group students by department and count them.

20. Show departments with more than 5 students (GROUP BY + HAVING).


Section F – Advanced Queries

21. Show top 3 students with the most borrowings.

22. Use aliases to rename columns in any 3 queries.


23. Find books that have never been borrowed using NOT IN.

24. Show all borrowings that happened in the last 30 days.

You might also like