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 (8th 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)
- WorksOn Database: Employee (EmployeeNumber, EmployeeName, BirthDate, Title, Salary, DepartmentNumber) Project (ProjectNumber, ProjectName, Budget, DepartmentNumber) Department (DepartmentNumber, DepartmentName, ManagerNumber) WorksOn (EmployeeNumber, ProjectNumber, Responsibility, Hours) Questions: 1) Write an SQL query that returns the project number and name for projects with a budget no greater than $1,050,000. 2) Write an SQL query that returns all works on records where hours worked is less than 5 and the responsibility is 'Manager'. 3) Write an SQL query that returns the employees (number and name only) who have a title of 'EE' or 'SA' and make more than $50,000. 4) Write an SQL query that returns the employees (name and salary only) in department 'D1' ordered by decreasing salary. 5) Write an SQL query that returns the departments (all fields) ordered by descending department name.arrow_forwardQuestion 11 Write SQL statements to answer the following question based on the ERD below. Note: Display only the attribute(s) required in the question. You need to provide complete answers, writing just keywords like SELECT, FROM, WHERE will receive 0 point. Question: List course name, section ID, and the average student grade (as GPA) in that section, for each section that was offered in 'Spring 2010' and order the result in descending order of section ID. STUDENT PK G_number FirstName LastName Address REGISTRATION PK FK G_number PK FK Sectionid DateEnrolled Grade 140 (DC) ALT+N+F10 (Mac) COURSE PK CourseID PK CourseName Course Desc CourseDept F SECTION SectionID FK Course D Semester Year Է t + 78v ABC > 5 600arrow_forwardWrite the appropriate SQL query for each of the following questions: 1) Display details of ALL the clubs running by the college 2) Display the details of the IT club (IT is the name of the club)arrow_forward
- Below is part of a Student database. The primary keys are highlighted in bold. Student (studNo, studName, address, mobileNo) Registration (studNo, courseNo, regDate, semester, session) Course (courseNo, courseName, creditHour, level) Project (projNo, projName, courseNo) Assignment (projectNo, studNo, startDate, dueDate, hoursSpent) QUESTION 1. Write a PL/SQL FUNCTION that calculates the cost each student has to pay for all courses taken. In the photo is example the cost detail for each course. 2. Write a PL/SQL Procedure to call the function you created in question 1 . Allow the user to enter the student ID (studno). SECOND PHOTO IS THE EXAMPLE OF EXPECTED OUTPUTarrow_forwardIn SQL This sample database consists of the following tables(see image for tables and there is one more at the bottom in this text):• Customers: stores customer’s data• Products: stores a list of scale model cars• ProductLines: stores a list of product line categories• Orders: stores sales orders placed by customers• OrderDetails: stores sales order line items for each sales order• Payments: stores payments made by customers based on their accounts• Employees: stores all employee information as well as the organization structuresuch as who reports to whom• Offices: stores sales office data Write SQL code for the following:We want to add a new sale order for the customer (customerNumber = 145) in thedatabase. The steps of adding a sale order are described as follows:(1) Get latest sale order number from “orders” table, and use the next sale ordernumber as the new sale order number(2) Insert a new sale order into “orders” table for the customer (customerNumber =145). For this order, the…arrow_forwardIn SQL This sample database consists of the following tables(see image for tables and there is one more at the bottom in this text):• Customers: stores customer’s data• Products: stores a list of scale model cars• ProductLines: stores a list of product line categories• Orders: stores sales orders placed by customers• OrderDetails: stores sales order line items for each sales order• Payments: stores payments made by customers based on their accounts• Employees: stores all employee information as well as the organization structuresuch as who reports to whom• Offices: stores sales office data Write SQL code for the following:We want to add a new sale order for the customer (customerNumber = 145) in thedatabase. The steps of adding a sale order are described as follows:(1) Get latest sale order number from “orders” table, and use the next sale ordernumber as the new sale order number(2) Insert a new sale order into “orders” table for the customer (customerNumber =145). For this order, the…arrow_forward
- Sales Database: Customers(custId, lastName, firstName, address, phone, creditLimit) Orders(ordNumber, itemNumber, qtyOrdered.) Items(itemNumber, itemName, price) For the Sales Database referenced above, write the SQL command to create the LineItem table, assuming the Orders table and items table already exist.arrow_forwardTrue or False below: Given two relations named A and B, if we q-JOIN A and B, the maximum number of attributes in the result relation could be (the number of attributes of A) times(*) the number of attributes of B). * in an SQL SELECT statement means “all the tuples”. In relational algebra, Cartesian Product (X) can be implemented using the q-JOIN operator. Cartesian Product ISA q-JOIN where q-condition always evaluates to true. SQL is based on Predicate Calculus. A query in SQL always specifies what should be included in the query result.arrow_forwardPATHS is a table that contains information about paths on a number line. The structure of PATHS is as follows, where x1 and x2 represent that there is a path from Coordinate x1 to Coordinate x2 (You can't move from Coordinate x2 to Coordinate x1 ). NAME ΤΥΡE NULLABLE X1 INT FALSE X2 INT FALSE Problem Please write an SQL statement that returns the beginning and end point of each path in PATHS . Sort them by the value of the beginning point in ascending order. Constraints • In the case where a direct path from Coordinate a to Coordinate b is available, no path from Coordinate b to Coordinate a will be given. |x1-x2| = 1 • No path will overlap with one another. Example Suppose that PATHS is as follows: x1 x2 1 2 2 3 4 7 7 6 This table can be visualized as follows: START END END START 7 8. 9 Therefore, your SQL statement must return the following: start end 1 4 8 6arrow_forward
- Write the appropriate SQL query for each of the following questions: A) Display ALL the activities organized by the IT club B) Display the number of students who are acting in each club.arrow_forwardhttps://sqliteonline.com/ : Program link The first requirement: Using the SQL language, transform the following entity model into tables in the database. Entity Manger contains: M-name The name of the manager. M-ID and manager number.The department entity contains: D-name The name of the department. D-ID and department number.Create constraint master key name of the manager when creating the Manger table.Creating the foreign key constraint The name of the manager when creating the Department table. The second requirement: After creating the tables and specifying the primary and foreign key, do the following: * Add a column D_loc to the Department table, specifying the type of column.* Remove the column named M_name from the Manger table* Change the name of the department table to Dep Please:: ******* ATTACH A PICTURE OF THE CODES USED AND PICTURE OF THE PROGRAM SCREEN *******arrow_forwardsql queries Employees(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE,JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID,DEPARTMENT_NAME)Department(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID)Location(LOCATION_ID,STREET_ADDRESS,POSTAL_CODE,CITY,STATE_PROVINCE,COUNTRY_ID) Write a query in SQL to display the Entire data of All those employees whoseDEPARTMENT_ID is greater than the DEPARTMENT_ID of all those employees who earn morethan 50,000 per month Write a query in SQL to display the minimum, maximum salary and DEPARTMENT_NAMEof all those departments whose minimum salary is greater than 4000 in ascending order.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 LearningA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage