Provide the MySQL commands for the following queries. Make sure that your
queries produce the exact output as shown (row order can be different).
[1] List the ids, first names, last names, majors, minors, and advisor's faculty ids of
students majoring or minoring in CSCI and having a faculty advisor in the following
manner.
+--------+-------+-------+-------+-------+---------+
| stuId | fname | lname | major | minor | advisor |
+--------+-------+-------+-------+-------+---------+
| 100000 | Tony | Hawk | CSCI | CINF | 1011 |
| 100001 | Mary | Hawk | CSCI | CINF | 1011 |
| 100002 | David | Hawk | CSCI | ITEC | 1012 |
| 100009 | Linda | King | ARTS | CSCI | 1018 |
+--------+-------+-------+-------+-------+---------+
4 rows in set (0.000 sec)
[2] Show the information (id, fname, lname and major program name) of all
students enrolled in the class 10003 in the following manner.
+--------+-------+---------+------------------------------+-------------------+
| stuId | fname | lname | major | class 10003 grade |
+--------+-------+---------+------------------------------+-------------------+
| 100000 | Tony | Hawk | Computer Science | C |
| 100002 | David | Hawk | Computer Science | D |
| 100004 | Larry | Johnson | Information Technology | A |
| 100005 | Linda | Johnson | Computer
+--------+-------+---------+------------------------------+-------------------+
Step by stepSolved in 2 steps with 2 images
- The FOREIGN KEY constraint should be added to which table? ( refer to the tables in the JustLee Books database). a. the table representing the "one" side of a one-to-many relationship b. the parent table in a parent-child relationship c. the child table in a parent-child relationship d. the table that doesn’t have a primary keyarrow_forwardTask 6: The Car Maintenance team considered that the available maintenance tasks should also have the price information in the database. Alter the MAINTENANCE_TYPES table to include a new column named MAINTENANCE_PRICE of type FLOAT. ANSWER IN MYSQL PLEASEarrow_forwardAssignment 6: Creating the Babbage Bookkeeping Database Create a relationship between two tables. Specify referential integrity between the Bookkeeper table (the one table) and the Client table (the many table). Save the Relationships. Create the following queries. Create a query for the Client table. The query must display Client Number, Client Name, and Balance fields for all clients located in Empeer with a balance greater than $300.00. Do not display City field. Save the query as “Q21-Client-Empeer Query.” Create a query to display the Client Number, Client Name, and Address fields for all clients with an address on Maum. Save the query as “Q22-Client-Maum Query.” Create a query that will allow the user to enter the city to search when the query is run. The query results should display the Client Number, Client Name, and Bookkeeper Number. Test the query by searching for those records where the client is located in Portage. Save the query as “Q23-Client-City…arrow_forward
- Given the table PRODUCT(ProductID, ProductName, ProductClass, ProductWeight, ProductStyle, ProductColor, ProductPrice). Note: ProductWeight and ProductPrice are numeric fields, and the other attributes are character fields, i.e., store text. Write a SQL query to display the product class whose average price is at least 50arrow_forward8. The head of the hospital’s accounting department is concerned about the prescribed charge for services versus the actual charges for services in the surgery category of services (service_cat_id = ‘SUR’). Produce a listing of surgery services listed in the treatment table by service_id where the prescribed service_charge differs from the actual_charge recorded in the treatment table. The result table should also include the service_charge and actual-charge. Use a subquery approach to produce a listing of service_id values from the service table that belong to the ‘SUR’ category of services. Display the result table with the service and actual charges formatted to include the dollar sign ($)arrow_forwardFor this problem create a (temporary) table called instructor_course_nums. Write a procedure that accepts an instructor ID as input. The procedure calculates the total number of course sections taught by that instructor, and adds a tuple to the temporary table consisting of the instructors ID number, name, and total courses taught - call these attributes: ID, name, and tot_courses. If the instructor already has an entry in the table,then the procedure makes sure the total number of courses taught in the temporary table is up-to-date. You must name your procedure: Written in PostgreSQLarrow_forward
- You are working with a database table that contains invoice data. The table includes columns for invoice_id and billing_state. You want to remove duplicate entries for billing state and sort the results by invoice ID. You write the SQL query below. Add a DISTINCT clause that will remove duplicate entries from the billing_state column. NOTE: The three dots (...) indicate where to add the clause. SELECT ... FROM invoice ORDER BY invoice_id What billing state appears in row 17 of your query result? 1 point 1-CA 2-NV 3-WI 4-AZarrow_forwardPLZ help with the following: 1. Populate every relation with “sufficient” representative rows (at least 4 for each table). Create table book (title varchar(80) not null, year INT not null , num INT primary key , subject Varchar(50) null); Create table client (CID int primary key,fname varchar(20), lname varchar(20), type varchar(6), constraint checkclient check (type in ('Faculty', 'Student'))); Create table author (year INT, ID INT primary key, fname varchar(50) not null,lname varchar(50)); Create table BookAuthors(booknum int, authorID int, primary key (booknum, authorID), constraint fk_book foreign key (booknum) references book(num),constraint fk_author foreign key (authorid) references author(id)); create table bookcheckouts( booknum int, clientID int, checkoutdate date, expectedDuedate date not null, returnedate date, primary key (booknum, clientID, checkoutDate),constraint book_checks foreign key(booknum) references book(num),constraint book_clients foreign key…arrow_forwardCreate a view, using JOBS, DEPARTMENTS, and JOB_HISTORY tables that will include department name (not ID), job title (not jobID), start date, and end date for all rows in the JOB_HISTORY table Using your view, write a query that shows the number of rows (count) for each department. Write a query that uses your view from above to select the columns department name, job title, and end date for all rows where the department name includes the string “Sale” that is NOT case-sensitive. Use a function. i.e. SALE, SaLe, Sale, sAle, etc. should all match a rowarrow_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