Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write an SQL CREATE TABLE statement to create the PET_OWNER table, with
OwnerID as a surrogate key. Justify your choices of column properties.
The following table schema for the PET_2 table is an alternate version of the PET table—
use it to answer review questions 3.11 and 3.12:
PET_2 (PetName, PetType, PetBreed, PetDOB, OwnerID)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
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 Create Table SQL statements based on the above ERD. All tables must have primary keys. All tables must have appropriate foreign key constraints. Foreign keys must have the same name, datatype and size of the primary key that they refer to The following columns datatypes and sizes must be used: bid,authid / number(4) title,sname,fname / varchar2(30) sellingprice, payrate / number(6,2) Table Column Type Range author sname & fname Unique book title Not Null book sellingprice Check not negative allocation payrate Check 1 to 79.99arrow_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_forwardSQL Code for Extend the code in (Perform a LEFT OUTER JOIN between the tables Wicketkeeping and Batting. You may select any column(s). Look at the result and state how many wicketkeepers have not played as batsmen (no need to write code for this part ) To show the name of the fielders who have played 7 times as many matches as the wicketkeeper(s) in 5).arrow_forward
- Write SQL statements to create at the two tables for the database. The tables must have at least three relevant columns with appropriate types, a primary key and at least one table should have a foreign key and the related foreign key constraints. CREATE TABLE students ( Student_id int NOT NULL PRIMARY KEY, Stud_firstname VARCHAR(30) NOT NULL, Stud_lastname VARCHAR(30) NOT NULL, Stud_email VARCHAR(80) NOT NULL UNIQUE advisor_id int, ); create table advisor ( advisor_id int not null primary key, stud_id int, adv_firstname varchar(30), adv_lastname varchar(30), foreign key(student_id) references students(student_id) ); [keep getting error, need help correcting]arrow_forwardTask 2: The Car Maintenance team also wants to store the actual maintenance operations in the database. The team wants to start with a table to store CAR_ID (CHAR(5)), MAINTENANCE_TYPE_ID (CHAR(5)) and MAINTENANCE_DUE (DATE) date for the operation. Create a new table named MAINTENANCES. The PRIMARY_KEY should be the combination of the three fields. The CAR_ID and MAINTENANCE_TYPE_ID should be foreign keys to their original tables. Cascade update and cascade delete the foreign keys. Create a new table to store maintenance operations Test Query DESCRIBE MAINTENANCES Expected Results Field Type Null Key Default Extra CAR_ID char(5) NO PRI NULL MAINTENANCE_TYPE_ID char(5) NO PRI NULL MAINTENANCE_DUE date NO PRI NULLarrow_forwardTask 2: The Car Maintenance team also wants to store the actual maintenance operations in the database. The team wants to start with a table to store CAR_ID (CHAR(5)), MAINTENANCE_TYPE_ID (CHAR(5)) and MAINTENANCE_DUE (DATE) date for the operation. Create a new table named MAINTENANCES. The PRIMARY_KEY should be the combination of the three fields. The CAR_ID and MAINTENACNE_TYPE_ID should be foreign keys to their original tables. Cascade update and cascade delete the foreign keys. Answer in MYSQL pleasearrow_forward
- Based on the following authorication commands (ordered from 1 to 4), which of the following privileges is true, assuming that Ali is the owner of the database? Order By Ali 1 2 3 4 Select one: Omar Ali Ali Command Grant Select on Employee to Omar with grant option; Grant Select on Employee to Samer with grant option; Grant Update on Employee to Omar with grant option; Revoke Select on Employee From Omar Cascade; a) Ali and Omar have Update privilege on employee Ali has select privilege on employee b) Ali and Omar have Update privilege on employee Omar and Samer have select privilege on employee elect c) Ali and Omar have Update privilege on employee Ali and Omar have select privilege on employee d) Ali and Omar have Update privilege on employee Ali, Omar and Samer have select privilege on employeearrow_forwardMy SQL WORKBENCH **Please note that you may actually use as many tables as you need. You are not limited to use only twotables.Example:SELECT *FROM DEPARTMENTS;SELECT *FROM EMPLOYEES;Now join departments and employees tables.SELECT FIRST_NAME, DEPARTMENT_NAMEFROM EMPLOYEES, DEPARTMENTSWHERE EMPLOYEES.DEPARTMENT_ID = DEPARTMENTS.DEPARTMENT_ID;NOTE: If you omit the join condition, the result will be the Cartesian Product of the two tables. A CartesianProduct joins all rows of the first table with all rows of the second table.That is if the first table has n rows and the second table has m rows, the output will have n*m rows.The following query will produce a Cartesian Product:SELECT FIRST_NAME, DEPARTMENT_NAMEFROM EMPLOYEES, DEPARTMENTS;**When table names are long, qualifying column names might be very time consuming. Usually peopleprefer to use table aliases for this purpose.Example: List the name of all employees who work for 'Purchasing' departmentSELECT E.FIRST_NAME "EMPLOYEE…arrow_forwardAssistance with SQL statements Previous code; CREATE TABLE Lab4program_piershed ( code VARCHAR(5) PRIMARY KEY, name VARCHAR(20), tel VARCHAR(20));CREATE TABLE Lab4course_xxxx ( cid INT PRIMARY KEY, name VARCHAR(20), credits INT, mycode VARCHAR(5), FOREIGN KEY (mycode) REFERENCES Lab4program_xxxx(code)); 1. Insert 3 records into your Lab4program_xxxx table. The code should be "CPS", "TECH", "MATH", or "BIO". Please copy/paste your SQL statements with the output message in the text that shows you successfully insert 3 records to your table. 2. Insert 4 records into your Lab4course_xxxx table with at least 2 different mycode. Please copy/paste your SQL statements with the output message in the text that shows you successfully insert 4 records to your table.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education