Concept explainers
Use SQL to make the following changes to the Henry Books database (Figures 1-4 through 1-7 in Chapter 1). After each change, execute an appropriate query to show that the change was made correctly. If directed to do so by your instructor, use the information provided with the Chapter 3 Exercises to print your output. For any exercises that use commands not supported by your version of SQL, write the command to accomplish the task.
Create a view named PLUME. It consists of the book code, title, type, and price for every book published by the publisher whose code is PL.
a. Write and execute the CREATE VIEW command to create the PLUME view.
b. Write and execute the command to retrieve the book code, title, and price for every book with a price of less than $13.
c. Write and execute the query that the DBMS actually executes.
d. Does updating the database through this view create any problems? If so, what are they? If not, why not?
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Create a table in SQL developer and name it as ‘MyCrush’. The table should consists of only three attributes as follows: Crush_ID which will be the primary key with the number length of .Crush_Name with the maximum character length of 30.Crush_Description with the maximum character length of 10.Insert exactly three records with the above given attributes. Crush_ID values should be 1, 2 and 3 for the three records. Crush_Description should be ‘Present’ for record 1, ‘Past’ for record 2 and ‘Childhood’ for record 3. If you don’t have any crush from your childhood to present, you can insert some random names. Hmm.. Seems Interesting!! It’s time to implement your programming skills using PL/SQL stored procedures and functions. Create another table called ‘MyDetails’ and should contain exactly four attributes as below: Student_ID,Student_Name ,Student_Term ,Student_GPA If you are not a Master’s student, let’s assume you are a student pursuing masters and taking four semesters or terms.…arrow_forwardIn the Testa EV database described in the previous question, fill in the blanks in the following MySQL statement to list (in this order) all the part numbers of components of 'EV Dashboard' (with Part_No=1) and their quantities; sort the results in ascending order of quantity of components (i.e., components with small quantities are listed first). (Please ensure correctness in the spelling of all names and commands. Do not enter unnecessary symbols such as spaces or commas)arrow_forwardPlease use sql to answer the follwoing question (an erd has also been add) Task 2: Task: UPDATE all employees salary in department 40 or 60 depending on their current salary range. Create a cursor and load all the records belongs to employees who works in department either in 40 or 60 a) Include employee_id, last_name, department_id and salary in Cursor SELECT Cursor cur_emp1 IS SELECT employee_id, last_name, department_id, salary FROM EMPLOYEES WHERE department_id IN (40,60); b) Now inside BEGIN and END block create CURSOR FOR LOOP with k keyword. FOR k IN cur_emp1 LOOP END LOOP; now inside above for loop check each records salary IF If employee salary is less than 5000 then add 20% of their salary and update actual phsyical table update employees SET salary= salary*1.20 WHERE employee_id = k.salary; Else if if employee salary is less then 8000 add 15% update employees SET salary=…arrow_forward
- 4. This question continues from Q3. (a) Write the insert SQL to populate the Zoom, BB, and the QR tables with the values given below. For each table, use only one insert to complete the insert task. The Duration column is initially empty. (b) Can you insert the ZOOM table first? Provide a reason according to the relational database theory if it is not possible. (c) Write a Delete SQL to remove student ‘M M’ from the BB table. If it is not possible to remove the row, provide a reason according to the relational database theory. You must not use SID in the SQL because only the name is given. (d) Write an Update DML that will compute and update the duration in minutesin the Zoom table. Show the updated table and the DML.arrow_forwardI would like to create a function to sum up total order amount within the date range, but i don't know how to write the right query. The query below is for counting the total orders, but I want to change to sum up total order amount. The Database table is attached. Please assist. ************************************** USE SQLBook; DROP FUNCTION IF EXISTS GetDateRangewithordersAmountGO CREATE FUNCTION GetDateRangewithordersAmount( @startDate DateTime, @endDate DateTime)RETURNS TABLE ASRETURN ( select [State], count (*) as [TotalOrderAmount] FROM [SQLBook].[dbo].[Orders] WHERE [OrderDate] between @startDate AND @endDate group by [State])GO SELECT * FROM GetDateRangewithordersAmount('2015-09-01','2015-10-31');GOarrow_forwardWrite SQL statements to create at the two tables for the database. The tables must have at least three relevant columns with appropriate types, a primary key and at least one table should have a foreign key and the related foreign key constraints. CREATE TABLE students ( Student_id int NOT NULL PRIMARY KEY, Stud_firstname VARCHAR(30) NOT NULL, Stud_lastname VARCHAR(30) NOT NULL, Stud_email VARCHAR(80) NOT NULL UNIQUE advisor_id int, ); create table advisor ( advisor_id int not null primary key, stud_id int, adv_firstname varchar(30), adv_lastname varchar(30), foreign key(student_id) references students(student_id) ); [keep getting error, need help correcting]arrow_forward
- Use the Pine Valley Furniture (PVF) database for this question. Write a SQL query to display the customer ID and total number of orders placed for those customers who placed more than one order.arrow_forwarduse sql to answer the following question To perform below tasks, refer to tables in the JustLee Book database. Create a list that display the title of each book and the name and phone number of the contact at the publisher’s office for reordering each book. Which books were written by an author with the Last Name-First Name (BAKER JACK)? Perform the search using author’s last name/first name. Determine which book(s) purchased by customer Steve Schell. Perform the search using the customer name & last name, not the customer number. If he/she has purchased multiple copies of the same book, unduplicated(DISCTINC) the result.arrow_forwardPLZ HELP WITH THE FOLLOWING QUESTION Using oralce sql or sql live Create a view named all_volunteer that gets details of all volunteers that assigned tasks in the organization. CREATE TABLE Packinglist( List_ID INT NOT NULL, Name VARCHAR(50), Description VARCHAR(100), PRIMARY KEY(List_ID)); CREATE TABLE Task( Task_Code INT NOT NULL, List_ID INT, Task_Description VARCHAR(100), Type VARCHAR(30), Status VARCHAR(20), PRIMARY KEY(Task_Code), FOREIGN KEY(List_ID) REFERENCES Packinglist(List_ID)); CREATE TABLE Volunteer( Vol_ID INT NOT NULL, Name VARCHAR(50), Telephone NUMBER, Address VARCHAR(100), PRIMARY KEY(Vol_ID)); CREATE TABLE Assignment( Vol_ID INT, Task_Code INT, Start_Time TIME, End_Time TIME, PRIMARY KEY(Vol_ID, Task_Code), FOREIGN KEY(Vol_ID) REFERENCES Volunteer(Vol_ID), FOREIGN KEY(Task_Code) REFERENCES Task(Task_Code)); CREATE TABLE Package( Pack_ID INT NOT NULL, Task_Code INT, Date DATE, Weight FLOAT, PRIMARY…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education