Database Concepts (8th Edition)
8th Edition
ISBN: 9780134601533
Author: David M. Kroenke, David J. Auer, Scott L. Vandenberg, Robert C. Yoder
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 5, Problem 5.35RQ
Code an SQL statement that creates a table with all columns from the parent and child tables in your answer to question 5.34. Code an SQL statement using a left outer join that creates a table with all columns from the parent and child tables. Explain the difference between these two SQL statements.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule07:48
Students have asked these similar questions
Write an SQL query that uses a multiple-column subquery in a FROM clause. Explain what the query is intended to do.
Write an SQL query that is based on multiple tables and uses a subquery with the GROUP BY statement and HAVING clause. Explain what the query is intended to do.
Write an SQL query that is based on multiple tables and uses a multiple-row subquery in a WHERE clause. The subquery will include the GROUP BY statement and another multiple-row subquery in a HAVING clause. Explain what the query is intended to do.
Write an SQL query that joins three tables and uses any type of a subquery. Explain what the query is intended to do.
Write an SQL query that is based on multiple tables and uses the DECODE function. Explain what the query is intended to do.
(a) What SQL statement would you use to create the table ”staff”, including specifying the primary key?
(b) What SQL statement would you use to find out how many lecturers there are in the School of Computing?
(c) What SQL statement would you use to list the lecturers of the modules COMP1121 and COMP1211?
(d) Write an SQL statement, using the inner join construct, that will, for the lecturer John Smith, list in alphabetical order the students taking any module which he teaches.
(e) What information does the output from the following SQL query provide?
SELECT Lecturer, COUNT(DISTINCT Student)
FROM class INNER JOIN staff
ON class.Module = staff.Module
WHERE Grade < 40
GROUP BY Lecturer;
(f) Write an SQL query which would obtain the following information: for each lecturer, what is the average grade obtained by students across all of the modules which they have taught?
A. Write SQL statements to create a table named STUDENT, with the following columns:
StdID: character field of width 10, null is not allowed
AdvID: character field of width 10, null is not allowed
B. Given that the STUDENT table is created in part (a), write a SQL statement to insert a constraint to STUDENT table created in part (a) to designate StdID as the primary key (Do not recreate another STUDENT since it was already done in part a).
Chapter 5 Solutions
Database Concepts (8th Edition)
Ch. 5 - Explain how entities are transformed into tables.Ch. 5 - Prob. 5.2RQCh. 5 - Prob. 5.3RQCh. 5 - What is denormalization?Ch. 5 - Prob. 5.5RQCh. 5 - Explain the problems that denormalized tables may...Ch. 5 - Explain how the representation of weak entities...Ch. 5 - Explain how supertype and subtype entities are...Ch. 5 - Prob. 5.9RQCh. 5 - Prob. 5.10RQ
Ch. 5 - Show two different ways to represent the 1:1...Ch. 5 - Prob. 5.12RQCh. 5 - Prob. 5.13RQCh. 5 - Prob. 5.14RQCh. 5 - Prob. 5.15RQCh. 5 - Prob. 5.16RQCh. 5 - For your answer to question 5.15, code an SQL...Ch. 5 - Prob. 5.18RQCh. 5 - Prob. 5.20RQCh. 5 - Prob. 5.21RQCh. 5 - Explain how the terms parent table and child table...Ch. 5 - For your answers to questions 5.20, 5.21, and...Ch. 5 - Prob. 5.24RQCh. 5 - Prob. 5.25RQCh. 5 - Prob. 5.26RQCh. 5 - Prob. 5.27RQCh. 5 - Prob. 5.28RQCh. 5 - Define the three types of recursive binary...Ch. 5 - Prob. 5.30RQCh. 5 - Prob. 5.31RQCh. 5 - Prob. 5.32RQCh. 5 - Prob. 5.33RQCh. 5 - Prob. 5.34RQCh. 5 - Code an SQL statement that creates a table with...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Car Class Write a class named Car that has the following fields: yearModel. The yearModel field is an int that ...
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
What would be the output in Self-Test Exercise 5 if the assignment were changed to the following? intextra=0;
Absolute Java (6th Edition)
Write a program that asks the user to type in two integer values at the terminal. Test these two numbers to det...
Programming in C
What statement do you have to have in a value-returning function?
Starting Out with Python (4th Edition)
What is the difference between the instructions 0x15AB and 0x25AB in Vole?
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write the SQL code to delete the row for William Smithfield, who was hired on June 22, 2004, and whose job code is 500. (Hint: Use logical operators to include all of the information given in this problem.)arrow_forwardTHIS MODULE IS ABOUT SUBQUERIES, SO YOU MUST USE SUBQUERIES INSTEAD OF TABLE JOINS (a) From which two fields in which table can you calculate the enrollment of a section?(b) From which table can you get both course and section numbers?(c) Which field in table SECTION uniquely identifies a section, section id or section no?(d) Write a SQL statement to show sections and their enrollment.(e) Write a SQL statement to show sections with enrollment greater than five. Display both course andsection numbersarrow_forwardquestion 5 please use the picture below to answer the following question Assuming all other tables are already created, write a SQL statement to create the following tables and the given constraint(s).arrow_forward
- Table: Team Member Primary key: Team MemberID Team MemberID 1 2 3 Team MemberName Joe Bloggs Samantha Smith Pete Ngwenya Table: Task Primary key: TaskID Foreign key: Team MemberID TaskID 1 2 3 Description Build login screen Implement inventory management Add logo to splahs 1 screen TeamMemberEmail joe@theoffice.com sam@theoffice.com pete@theoffice.com Duration StartDate Team MemberID 2022-05-06 1 2022-05-15 1 4 10 2022-05-06 2arrow_forwardAnswer the following questions based on the information in the PATIENT table below. Write SQL queries statement and provide the output of each query. (Screenshot the interface in MySQL that show SQL statement and output for each question). PATIENT PID PNAME AGE ADATE 1001 JAMAL 35 2000-10-28 M 1002 TAN 52 1003 MARIAM 30 2000-11-20 M 2000-07-16 F 2000-12-18 M 1004 JOE 27 1005 SOFEA 19 2000-04-25 F 1) Change the admission date of Sofea to 18-12-2000. GENDERarrow_forwardWrite a SQL statement to get the list of all the law firms from thedatabase in alphabetical order by firm name. Include all thecolumns from the LawFirm table.arrow_forward
- Instructions Write SQL queries to solve the following problems. We will be using the “university” database. All queries should involve only the instructor table. After you are done, save your work as .sql file and turn in the .sql file into Moodle for grading. Write a SQL statement to display all columns using the SQL asterisk (*) wild-card character. Write a SQL statement to display ID and name of the instructors (ID appears first). Write a SQL statement to display department names. Write a SQL statement to display unique department names. (expect 7 rows returned) Write a SQL statement to display all info about instructors having a salary greater than 75000. (expect 6 rows returned) Write a SQL statement to display department name, instructor name, and salary for instructors that have a salary less than 70000. Sort the results in ascending order by department name. (expect 4 rows returned) Write a SQL statement to display name, department name, and salary for instructors that have a…arrow_forwardCreate all the tables as shown in schema. Import or execute the SQL statements given in data.sql. Write SQL queries for the following statements. Submit screen shot of query and result. Show the name of movies which were released in both 2D and 3D. (Use Natural join) Show all customer names along with movie names they booked. Show all the customer names whether they booked any move or not. Also show all movie names whether they were booked by a customer or not. (Use Outer Join) Show movie names along with the total number seats that were booked for it. (Use Aggregate Function) Show category names along with the number of movies present in that category. (Use Aggregate Function) Show movie names which has a play time of more than 2 hours or they are in 3D.(Use set operations) Show staff names who live in ‘kharian’ but they have not done any booking as yet. (Use nesting) Show movies having same release dates. Show movie names which have got the maximum bookings. From the given…arrow_forwardYou are given the schema of a table with its columns inside the bracket as follows: STUDENT(Name, Student_id, Major, Marks, Email) (The Primary Key is underlined) Write an SQL query for the following tasks: (Hint: the queries are nested) 1. Write an SQL query to retrieve the name, student id and the maximum marks of students of each major where that maximum marks is greater than all students with CS major. 2. Write an SQL query to retrieve the name, student id and the maximum marks of students with ECE major where that maximum marks is greater than all students with CS major.arrow_forward
- can you help me iwth these two queries in mySQL. Write a SQL statement to create a table job_history including columns employee_id, start_date, end_date, job_id and department_id and make sure that, the employee_id column does not contain any duplicate value at the time of insertion and the foreign key column job_id contain only those values which are exists in the jobs table. Write a SQL statement to create a table employees including columns employee_id, first_name, last_name, email, phone_number hire_date, job_id, salary, commission, manager_id and department_id and make sure that, the employee_id column does not contain any duplicate value at the time of insertion and the foreign key columns combined by department_id and manager_id columns contain only those unique combination values, which combinations are exists in the departments table.arrow_forwardAssume that you have a table ABC that contains two columns: employee name e namen and the salary sal. Write a SQL statement that lists all employees' names and gives each a 15% pay increase and display new salary always rounded down to the nearest whole number. Display name, old salary, and new salary. Use the editor to format your answer Question 14 Write a SQL statement to un-grant the select and alter privilege from the user Almed. Assume that the table name is 'asudent Use the editte formot vearrow_forwardAnswer the following questions based on the information in the PATIENT table below. Write SQL queries statement and provide the output of each query. (Screenshot the interface in MySQL that show SQL statement and output for each question). PATIENT PID 1001 JAMAL 35 1002 TAN 52 PNAME AGE ADATE 1003 MARIAM 30 1004 JOE 27 1005 SOFEA 19 GENDER 2000-10-28 M 2000-11-20 M 2000-07-16 F 2000-12-18 M 2000-04-25 F 2. Find the name of patient who admits on the same date as Sofea.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase 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
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
SQL Basics for Beginners | Learn SQL | SQL Tutorial for Beginners | Edureka; Author: edureka;https://www.youtube.com/watch?v=zbMHLJ0dY4w;License: Standard YouTube License, CC-BY