Database Concepts (7th Edition)
7th Edition
ISBN: 9780133544626
Author: David M. Kroenke, David J. Auer
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
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.
1. What is structured query language and how is it used?2. What is a primary key?3. What is a foreign key?4. Why would you need to join two tables?5. What is the difference between a one-to-one and a one-to-many relationship? Can you join 2 tables to create a many-to-many relationship?6. Write a SQL statement which does the following:a. Creates a new table with 3 fields: Firstname, Lastname, PID. b. Make PID the primary keyc. Why might this table contain a foreign key?7. Write an SQL statement for the above table that would find all people with the last name “Sweeney” and sort the results alphabetically by last name & first name.
9. What is the difference between DDL and DML?
You 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.
Chapter 5 Solutions
Database Concepts (7th 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
- How is the processing of SQL DDL statements (such as CREATE TABLE) different from the processing required by DML statements?arrow_forwardQuestion 1 Write SQL statements to answer questions 1.1, 1.2, 1.3 and 1.4 based on the following schema. Primary keys are( BOLD and italicized) and attributes with the same names in different tables are foreign keys. Doctors(doctorId, doctorLastName, doctorFirstName,specialtyID, numberOfPatientsSeen) Patients(patientId, patientLastName, patientFirstName, sex, patientBalance, numberOfVisits, patientDateOfBirth ) Records(doctorId, patientId, date, diagnosis, visitCost) Specialty(specialtyId, specialtyName, specialtyCost) 1.1) Create a view, called PatientSmithDoctors, to list all the doctors a patient with the last name of Smith has seen (be careful on this one). 1.2) Write a trigger, each time a row is inserted in the table Records, the numberOfVisits in the corresponding Patient row is updated by 1 (i.e. add 1 to the numberOfVisits) and the numberOfPatientsSeen in the Doctors table is also updated by 1. 1.3) Find the Patient’s full name with the…arrow_forwardConsider a scenario in which the SQL statement is of the form SELECT DISTINCT c1, c2, c3 from T. Why might it make sense to create an index to optimize this query?arrow_forward
- Consider the following schema:instructor(ID, name, dept_name, salary)What is the correct SQL statement to perform a query to find the names of all instructors excluding duplicates?(a) select name from instructor;(b) select unique name from instructor;(c) select name from instructor no duplicates;(d) select distinct name from instructor;arrow_forward(TCO 4) What will be displayed when the following SQL statement is executed?SELECT * FROM Employee: Group of answer choices All columns in only the first row of the Employee table Only the first column in all rows of the Employee table All rows and columns of the Employee table The number of rows in the Employee tablearrow_forwardHow does one properly model a many-to-many with history? What are foreign keys used for? What limitations are there on the values that can be inserted into a column that is a foreign key? Practice designing two classes in each of the possible relationships. Practice writing lots of SQL queries, especially using JOINs. Make sure you're clear on when an OUTER JOIN would be useful.arrow_forward
- 51. The given SQL statement is intended to either (1) list the customer numbers, customers names, and headquarter cities of customers headquartered in Los Angeles or (2) satisfy the two conditions of having a customer number higher than 1000 and being headquartered in Denver. SELECT CUSTNUM, CUSTNAME, HQCITY FROM CUSTOMER WHERE HQCITY= 'Los Angeles" Which set of lines should be added to the end of the statement to make the statement work as intended? A: (CUSTNUM>1000 AND HQCITY-'Denver'); B: AND (CUSTNUM>1000 AND HQCITY='Denver*); C:OR CUSTNUM>1000 OR HQCITY='Denver": D:OR (CUSTNUM> 1000 AND HQCITY='Denver*);arrow_forwardWrite the SQL statement that will list the city and state of all customers. If more than one customer is from the same city and state, only list that city and state once. Sort the output by state and then by city.arrow_forwardGive an example of a SQL statement that uses the DUAL table and explain what it does. Please be as detailed as possible. Thank you in advance!arrow_forward
arrow_back_ios
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 LearningA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
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
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
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