0% found this document useful (0 votes)
10 views5 pages

Query Practice

The document outlines a practical exercise completed by Farzeen Abbas in a Database System Lab, where a University database was created with three tables: Students, Courses, and Enrollments. It details the SQL queries practiced, including SELECT, JOIN, and data modification, as well as the application of data integrity constraints. The exercise demonstrates a comprehensive understanding of SQL concepts and database management.

Uploaded by

khadijanasir1607
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)
10 views5 pages

Query Practice

The document outlines a practical exercise completed by Farzeen Abbas in a Database System Lab, where a University database was created with three tables: Students, Courses, and Enrollments. It details the SQL queries practiced, including SELECT, JOIN, and data modification, as well as the application of data integrity constraints. The exercise demonstrates a comprehensive understanding of SQL concepts and database management.

Uploaded by

khadijanasir1607
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

Query Practice & Concept Understanding

Submitted by
Farzeen Abbas
Roll NO (24014198-258)
Section: C
Course Title: Database System Lab
Course Code: SE-204
Submitted to
Mam Alveena Ehsan
Department of Software Engineering
What I Did:
 Created a University database
 Made 3 tables: Students, Courses, Enrollments
 Added sample data
 Practiced all types of SQL queries

Tables I Created:

Students Table

o StudentID (Primary Key)


o FirstName (Cannot be empty)
o LastName (Cannot be empty)
o Email (Must be unique)
o Department

Courses Table
o CourseID (Primary Key)

 CourseTitle (Cannot be empty)


 CreditHours

Enrollments Table

 EnrollmentID (Primary Key)


 StudentID (Links to Students table)
 CourseID (Links to Courses table)
 Grade

Queries I Practiced:

1. Basic SELECT Queries


SELECT * FROM Students;
Results of SELECT * FROM Students query

2. JOIN Queries
SELECT [Link], [Link], [Link], [Link]
FROM Students s
JOIN Enrollments e ON [Link] = [Link]
JOIN Courses c ON [Link] = [Link];

JOIN query showing students with their courses and grades

3. Data Modification
-- Run these together and screenshot
SELECT * FROM Students; -- Show before
INSERT INTO Students VALUES (4, 'New', 'Student', 'new@[Link]', 'Science');
SELECT * FROM Students; -- Show after
4. Testing Rules

Duplicate email error


INSERT INTO Students VALUES (5, 'Test', 'User', 'ali@[Link]',
'IT');

Error message when violating UNIQUE constraint

Conclusion

I successfully practiced all SQL concepts including:


- Data Definition Language (DDL) - CREATE TABLE
- Data Manipulation Language (DML) - INSERT, UPDATE, DELETE, SELECT
- Data Integrity constraints - PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL
- Complex queries using JOIN operations

This practical exercise demonstrates my understanding of database concepts and SQL query
execution.

You might also like