Concept explainers
Are based on the class scheduling 3NF relations along with some sample data shown in Figure 6-11. Not shown in this figure are data for an ASSIGNMENT relation, which represents a many-to-many relationship between faculty and sections.
Note that values of the SectionNo column do not repeat across semesters.
Figure 6-11 Class scheduling relations (missing ASSIGNMENT)
Write SQL commands for the following.
a. Create two different forms of the INSERT command to add a student with a student ID of 65798 and last name Lopez to the Student table.
b. Now write a command that will remove Lopez from the Student table.
c. Create an SQL command that will modify the name of course ISM 4212 from
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Modern Database Management (12th Edition)
- An EMPLOYEES table was added to the JustLee Books database to track employee information. Display a list of each employee’s name, job title, and manager’s name. Use column aliases to clearly identify employee and manager name values. Include all employees in the list and sort by manager name.arrow_forwardReview the data for the TRIP table in Figure 1-5 in Chapter 1 and then review the data types used to create the TRIP table in Figure 3-39. Suggest alternate data types for at least two fields that currently have the CHAR data type and at least two fields that currently have the DECIMAL data type. Create but do not execute the SQL command to create the TRIP table using these alternate data types.arrow_forwardDelete the OWNER_INDEX 3 index from the OWNER table.arrow_forward
- Write the SQL code that will restore the data to its original status: that is, the table should contain the data that existed before you made the changes in Problems 5 and 6.arrow_forwardEnsure that the only legal values for the BDRMS column in the CONDO_UNIT table are 1, 2, or 3.arrow_forwardTask 2: The Driver Relationship team wants to arrange workshops and education materials to the drivers. However, the team wants to create clusters of the drivers based on their experience in InstantStay. To collect these detail, you will need to create a SQL function called DRIVER_STATUS to determine the level of the driver as follows: MASTER: more than 4 travels PRO: more than 2 travels ROOKIE: 2 or less travels In addition, run the function to verify it works as expected and send them back the driver levels. Task: Create the DRIVER_STATUS function to create clusters of drivers based on experience. THIS CODE YOU SEE HERE IS WRONG. THERE IS AN ERROR AT LINE 2 DELIMITER < CREATE FUNCTION DRIVER_STATUS(int DRIVERID) RETURNS VARCHAR BEGIN DECLARE //to store number of travels Count int; //to store level Level VARCHAR; //Selects according to passed value SELECT COUNT(*) INTO Level FROM TRAVEL WHERE DRIVER_ID = DRIVERID; //returns level IF( Count > 4) THEN RETURN…arrow_forward
- Task 2: The Driver Relationship team wants to arrange workshops and education materials to the drivers. However, the team wants to create clusters of the drivers based on their experience in InstantStay. To collect these detail, you will need to create a SQL function called DRIVER_STATUS to determine the level of the driver as follows: MASTER: more than 4 travels PRO: more than 2 travels ROOKIE: 2 or less travels In addition, run the function to verify it works as expected and send them back the driver levels. Task: Create the DRIVER_STATUS function to create clusters of drivers based on experience.arrow_forwardTask 2: The Driver Relationship team wants to arrange workshops and education materials to the drivers. However, the team wants to create clusters of the drivers based on their experience in InstantStay. To collect these detail, you will need to create a SQL function called DRIVER_STATUS to determine the level of the driver as follows: MASTER: more than 4 travels PRO: more than 2 travels ROOKIE: 2 or less travels In addition, run the function to verify it works as expected and send them back the driver levels. SQL Database Test: SELECT DRIVER_ID, DRIVER_STATUS(DRIVER_ID) FROM DRIVERS Create the DRIVER_STATUS function Expected Results: DRIVER_ID DRIVER_STATUS(DRIVER_ID) 2001 MASTER 2002 ROOKIE 2003 PRO 2004 ROOKIE 2005 ROOKIEarrow_forward[ slide-15.png ] Q1. Please write SQL codes to create below rental database table based on the previous slide (slide 15) Video E-R Modling Diagram child table RENTAL 1. checkout_date and dvd_ID coulmns should be combined together as a composite primary key of the rental table, and rest columns are NOT NULL constraints except the checkin_date column (it might hold NULL values). 2. Rental table is a child table, and the member_id column is a foreign key column which references member table’s member_id primary key column. 3. Rental table is a child table, and the dvd_id column is a foreign key column which references dvd table’s dvd_id primary key column. DESC rental Name Null? Type checkout_date NOT NULL DATE dvd_ID NOT NULL NUMBER(4, 0) member_ID NOT NULL NUMBER(4, 0) checkin_date DATE expred_date NOT NULL DATEarrow_forward
- Using the EMPLOYEE, JOB, and PROJECT tables in the Ch07_ConstructCo database, write the SQL code that will join the JOB, EMPLOYEE, and PROJECT tables using common attributes. Display the attributes shown in the results presented in Figure P7.2, sorted by project value.arrow_forwardUsing the Schema - data/statistics Write down the following SQL queries. Assume appropriate data types for each attribute by yourself. 1) Create Bill table. 2)Assume you forgot to set SID as foreign key during creation of Bill table, by default SID is declared as null.Now you have to declare SID as foreign key. 3)Add constraint on names of customer that ensures that names must start with alphabet. 4)Delete constraint that was added in statement 3. 5)Add a new column in any one of the tables. 6)Delete the added column in statement 5 7)Show name of all those customers who have placed order after 23 June 2014 using subquery. 8)Show the data of those customers to who items were sold with SID 1 or 3 or 6 9)Show names of customers and items names of items sold to him 10)Make a vertical partition on customer table in such a way that changes in partitioned portion must be reflected on original table. 11) Update the city of customer as ‘Lahore’ where customer id is 3 12)Delete all those records…arrow_forwardPlease check the answer twice and add explanation to.every step Note - don't use AI answer ( i will report)arrow_forward
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning