Write an SQL statement to display the last name, first name, and email of any owners of cats. Use a subquery.
The following table schema for the BREED table shows a new table to be added to the pet
BREED (BreedName, MinWeight, MaxWeight, AverageLifeExpectancy)
Assume that PetBreed in PET_3 is a foreign key that matches the primary key BreedName in BREED and that we have the referential Integrity constraint:
PetBreed in PET_3 exist in BreedName in BREED
If needed, you may also assume that a similar referential integrity constraint exists between PET and BREED and between PET_2 and BREED. The BREED table data are shown in Figure 3-30.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Database Concepts (7th Edition)
Additional Engineering Textbook Solutions
C++ How to Program (10th Edition)
Modern Database Management (12th Edition)
Absolute Java (6th Edition)
C How to Program (8th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Digital Fundamentals (11th Edition)
- 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_forwardrun the SQL queries to return only the requested data. You must write only one SQL statement per item. That means only one semicolon ( ; ) in your answer. You may have subqueries in your statement. List the movie id, title, production id, and production name for all movies, sorted by the id of the movie, in decreasing order (largest first).arrow_forwardIn Sql These are some database from a set of tables insert into AccountHolder(AccountID, CustomerID, AccountType)values (55003, 115, 'Savings'),(44001, 101, 'Chequing'),(55006, 109, 'Savings'),(44002, 102, 'Chequing'),(44003, 113, 'Chequing'),(55007, 108, 'Savings'),(44004, 103, 'Chequing'),(44005, 110, 'Chequing'),(55005, 112, 'Savings'),(44006, 114, 'Chequing'),(55001, 111, 'Savings'),(44007, 107, 'Chequing'),(44008, 104, 'Chequing'),(55004, 106, 'Savings'),(44009, 105, 'Chequing'),(44010, 113, 'Chequing'),(55002, 107, 'Savings'),(44011, 110, 'Chequing'),(44012, 104, 'Chequing') select * from AccountHolder insert into Branch(LocationID, BranchName, Address, Type, DepositSum, LoanSum)values (1, 'Boulevard Branch', '3268 Wade Boulevard', 'Rural', 171848.88, 37681.72),(2, 'Avenue Branch', '4814 Dare Avenue', 'Rural', 232707.42, 68324.56),(3, 'Street Branch', '208 Ferry Street', 'Commercial', 375010.75, 44665.08),(4, 'Road Branch', '468 Zulauf Road', 'Commercial', 496001.41,…arrow_forward
- Assume that all the statements from Q.6.2 have been executed on the database.Q.6.3.1 Write a SQL statement to get the list of all the team members in thedatabase. Include only the name and email address of the teammembers.arrow_forwardWrite SQL update statements to do the following on the database schema shown in Figure 1.i. Insert a new course, <‘Knowledge Engineering’, ‘CS4390’, 3, ‘CS’>.ii. Delete the record for the student whose name is ‘Smith’ and whose student number is 17.arrow_forwardwrite the SQL statments for the database above to do the following:a)fing the each customer total annual premiumand order by the highest total annual premium to the least. b)find the customer's insurance has expired c)find the customer's insurance amost expired,which mean the insurance will expire in one montharrow_forward
- Execute the following statements using MYSQL: 1. Insert a row with the values (005, "Your name", , "Your Dept", 50000, 40) 2. Create a trigger (model trigger) to ensure that no employee of salary less than 20000 can be inserted in the database. Show the result for your trigger condition by inserting a new row. 3. Delete the trigger (model trigger) for the employee table. 4. Using SQL procedure with IN Parameter, returns the sum of salary of the table. 5. List out the names of the employee starting with "B" 6. List out the number of different employee names. Provide MySQL screenshotsarrow_forwardWrite a SQL query, which shows a list of all employees last name, their department names and their department city where that department is located from the employees table. If an employee does not belong to a department, then their department number should show as “N/A” and their department city should show up as “No City info Found”. MAKE SURE you have all the employees displayed including the employees who do not have a department.arrow_forwardWrite queries in SQL to answer each of the following questions: ************************************************************************************************ (Table: instructor (ID, name, dept_name, salary) student (ID, name, dept_name, tot_cred) teaches (ID, course_id, sec_id, semester, year) takes (ID, course_id, sec_id, semester, year, grade) ) 1. Find all instructors in Finance department who have taught some course in 2008. 2. Find all students from Physics department who took course 'CS-319'.arrow_forward
- Write the SQL syntax to create a table in the database called Employee with the employee first and last name, employee hire date, employee number, employee initial, and employee years.arrow_forwardWrite a SQL query that retrieves the names and email addresses of all students who are enrolled in at least one course in the "Computer Science" department and have a graduation year of 2022 or later. Include the course name and instructor name for each enrollment in the output. Schemas of the tables are below. "students" table: student_id: unique identifier for the student name: name of the student email: email address of the student major: field of study for the student graduation_year: expected year of graduation for the student "courses" table: course_id: unique identifier for the course course_name: name of the course instructor_name: name of the instructor teaching the course. department: department offering the course. course_description: description of the course "enrollments" table: enrollment_id: unique identifier for the enrollment student_id: identifier for the student enrolled in the course. course_id: identifier for the course the student is enrolled in…arrow_forwardWrite a SQL query that retrieves the names and email addresses of all students who are enrolled in at least one course in the "Computer Science" department and have a graduation year of 2022 or later. Include the course name and instructor name for each enrollment in the output. Schemas of the tables are below. "students" table: student_id: unique identifier for the student name: name of the student email: email address of the student major: field of study for the student graduation_year: expected year of graduation for the student "courses" table: course_id: unique identifier for the course course_name: name of the course instructor_name: name of the instructor teaching the course. department: department offering the course. course_description: description of the course "enrollments" table: enrollment_id: unique identifier for the enrollment student_id: identifier for the student enrolled in the course. course_id: identifier for the course the student is enrolled in…arrow_forward
- 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
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr