Concept explainers
Consider the following two relations for Millennium College:
STUDENT(StudentID, StudentName,
CampusAddress, GPA)
REGISTRATION (StudentID, CourselD, Grade)
Following is a typical query against these relations:
SELECT Student_T.StudentID, StudentName,
CourselD, Grade
FROM Student_T, Registration_T
WHERE Student_T.StudentID =
Registration_T.StudentID
AND GPA >3.0
ORDER BY StudentName;
- On what attributes should indexes be defined to speed up this query? Give the reasons for each attribute selected.
- Write SQL commands to create indexes for each attribute you identified in part a.
Learn your wayIncludes step-by-step video
Chapter 8 Solutions
EBK MODERN DATABASE MANAGEMENT,
Additional Engineering Textbook Solutions
Database Concepts (7th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Artificial Intelligence: A Modern Approach
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- What is the difference between a PRIMARY KEY constraint and a UNIQUE constraint?arrow_forwardJOIN TABLES One row in the PAT_ENC table represents one patient encounter. One row in the ORDER MED table represents one medication order. One patient encounter can have many medication orders but one medication order can only have one patient encounter. In other words, the cardinality of this PAT_ENC to ORDER_MED relationship is one-to- many. You start a query with PAT_ENC. You then add ORDER_MED using an inner join. What is true about the granularity of the result set before and after adding the ORDER_MED table? SELECT ONE OF THE FOLLOWING A. The granularity stays at one row per patient encounter. B. The granularity stays at one row per medication order. C. The granularity changes from one row per patient encounter to one row per medication order on an encounter. D. The granularity changes from one row per medication order to one row per patient encounter.arrow_forwardConsider the following relational schema and answer the following questions. Employee (Employee_Id, First_Name, Last_Name, Email, Phone_Number, Hire_Date, Job_Id, Salary, Commission_Pct, Manager_Id, Department_Id) Write a query to get the difference between the highest and lowest salaries. Write a query to find the manager ID and the salary of the lowest-paid employee for that manager. Write a query to get the department ID and the total salary payable in each department. Write a query to get the total salary, maximum, minimum, average salary of employees (job ID wise), for department ID 90 only. Write a query to get the average salary for all departments employing more than 10 employees.arrow_forward
- Using the university schema, write an SQL query to find the names and IDs ofthose instructors who teach every course taught in his or her department (i.e.,every course that appears in the course relation with the instructor’s department name). Order result by namearrow_forwardAnswer as soon as possiblearrow_forwardFor the following Student table, find all the possible functional dependencies that areheld.Schema: Student (Regno, Name, DOB, Phone, Instructor_ID, Instructor_Name, Instructor_Office)arrow_forward
- database nnnnnnnnnnn01arrow_forwardConsider the following two relations for Millennium College:STUDENT(StudentiD StudentName,CampusAddress, GPA)REGISTRATION(Student!D CourseiD Grade)Following is a typical query against these relations:SELECT Student_T.StudentiD, StudentName,CourseiD, GradeFROM Student_T, Registration_TWHERE Student_T.StudentiD =Registration_ T.StudentiDANDGPA>3.0ORDER BY Student Name;a. On what attributes should indexes be defined to speedup this query? Give the reasons for each attributeselected.b. Write SQL commands to create indexes for each attribute you identified in part a.arrow_forwardWrite a database description for each of the relations shown, using SQL DDL (shorten, abbreviate, or change any data names, as needed for your SQL version). Assume the following attribute data types:arrow_forward
- For the following Employee database, write a query to find the ID of each employee with no manager. Note that an employee may simply have no manager listed or may have a null manager. Write your query using an outer join and then write it again using no outer join at all. employee (ID, person_name, street, city) works (ID, company_name, salary) соmpany (compaпу лате, сіty) manages (ID, manager_id)arrow_forwardGiven the schema: department(department_id, department_name) employees (employee_id, first_name, last_name, salary, department_id) Write a query to get employee first_name along with their department name, only for those who have salary greater than 6000;arrow_forwardconvert it to relations that are normalizationarrow_forward