Ids 521 Adbms - Hw3 Updated
Ids 521 Adbms - Hw3 Updated
Data Population
Populate all relations (tables) in your database:
Enter tuples (data) for each relation using sample data from Chapter 2, Chapter 6, or the
Appendix of the textbook.
Populate at least one table or use one existing table(relation) with many records for analysis
purposes.
Index Creation
Create index files for the table(s) with many records.
Run queries on the indexed table(s) and compare the performance:
Record the performance of the query with the index.
Record the performance of the query without the index.
Submission Format
PDF:
Part A: Tables - Include screenshots of all tables/relations with sample data created beyond
HW2, specifically covering content from Chapter 3 and Chapter 4 of the textbook. Ensure these
tables/relations reflect updates and additions made after HW2.
Ensure that:
Include screenshots of your tuples (data) for all tables/relations after practicing the
queries (post topics from HW2).
Cover topics from Chapter 3 and Chapter 4 of the textbook.
Part B: Queries - Provide screenshots of all SQL queries (from Set Operations) from the lecture
slides, along with their execution results.
Basic Queries -
1. Selecting Attributes:
Select specific attributes from a table.
Use of DISTINCT to eliminate duplicates.
Arithmetic expressions in SELECT.
2. String Operations:
Pattern matching with LIKE.
String manipulation (UPPER, LOWER, CONCAT).
3. Ordering Results:
ORDER BY (ascending, descending).
4. Aggregate Functions:
AVG, SUM, MIN, MAX, COUNT.
Grouping results with GROUP BY.
Filtering grouped results with HAVING.
Set Operations
1. Union:
Combine results from multiple queries.
2. Union All:
Combine results without removing duplicates.
3. Intersect:
Retrieve common rows from multiple queries.
4. Except:
Retrieve rows in the first query but not in the second.
Set Membership
1. IN and NOT IN:
Membership check within subquery results.
2. ANY/SOME and ALL:
Compare values with results from a subquery.
Null Handling
1. IS NULL and IS NOT NULL:
Queries to check for null values.
Subqueries
1. Nested Queries:
Subqueries in WHERE, FROM, and SELECT.
Scalar subqueries.
2. Correlated Subqueries:
Subqueries that reference columns from the outer query.
Join Operations
1. Natural Join:
Combining tables using common attributes.
2. Inner Join:
Combining rows that meet a specific condition.
3. Outer Joins:
Left, Right, and Full Outer Joins.
Views
1. Creating Views:
Define views using CREATE VIEW.
2. Querying Views:
Retrieve data from a view.
Data Modifications
1. INSERT:
Insert new rows into a table.
Insert using a SELECT query.
2. UPDATE:
Update rows with conditions.
Conditional updates with CASE.
3. DELETE:
Remove rows based on conditions.
Integrity Constraints;
Primary Key
Foreign Key
Not Null
Unique Constraint
Check Constraint
Cascading Actions (ON DELETE, ON UPDATE)
Domains:
Creating a Domain
Using a Domain in Table Creation
Performance and Indexing
1. Index Creation:
Create indexes using CREATE INDEX.
2. Query Performance:
Compare execution with and without indexes.
Authorization
1. Grant Privileges:
Use GRANT to assign permissions.
2. Revoke Privileges:
Use REVOKE to remove permissions.