A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 7, Problem 7SCG
Delete the OWNER_INDEX 3 index from the OWNER table.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create an ADD TRIGGER. Explain what the trigger does. Test and show the related results of this trigger.
Table 1:
CREATE TABLE BSR_PASSENGER
(PASSENGER_ID INT NOT NULL UNIQUE,
FULL_NAME VARCHAR(30),
COUNTRY VARCHAR(40),
CITY VARCHAR (40),
PRIMARY KEY (PASSENGER_ID));
Table 2:
CREATE TABLE BSR_FLIGHT
(FLIGHT_ID INT NOT NULL UNIQUE,
AIRLINE_NAME VARCHAR(50),
CREW_MEMBERS INT,
PRIMARY KEY (FLIGHT_ID));
Table 3:
CREATE TABLE BSR_BOOKING
(BOOKING_ID INT NOT NULL UNIQUE AUTO_INCREMENT,
PASSENGER_ID INT NOT NULL,
FLIGHT_ID INT NOT NULL,
COST DEC(6,3),
PRIMARY KEY (BOOKING_ID),
FOREIGN KEY (PASSENGER_ID) REFERENCES BSR_PASSENGER(PASSENGER_ID),
FOREIGN KEY (FLIGHT_ID) REFERENCES BSR_FLIGHT(FLIGHT_ID));
Task 6: Add the following record to the OWNER table:
INSERT INTO OWNER VALUES('SA100', 'Sam', 'Afyouni', '100 Hello St', 'Anytown', 'MA', '55555');
CREATE TABLE sales ( SalesNumber INT(10) AUTO_INCREMENT PRIMARY KEY, SalesDate DATE, SalesTotal DECIMAL(10,2));
CREATE TABLE products ( number INT(11) AUTO_INCREMENT PRIMARY KEY, prodid VARCHAR(20) UNIQUE, prodname VARCHAR(30), price DECIMAL(10,2), onhand INT(11), CONSTRAINT fk_salesdetails_products FOREIGN KEY (prodid) REFERENCES salesdetails(prodid) ON DELETE RESTRICT);
CREATE TABLE salesdetails ( number INT(10) AUTO_INCREMENT PRIMARY KEY, SalesNumber INT(10), prodid VARCHAR(20), price DECIMAL(7,2), qty INT(10), CONSTRAINT fk_salesdetails_sales FOREIGN KEY (SalesNumber) REFERENCES sales(SalesNumber) ON DELETE CASCADE, CONSTRAINT fk_salesdetails_products FOREIGN KEY (prodid) REFERENCES products(prodid) ON DELETE CASCADE);
Using the above SQL and the schema diagram, create an ER diagram detailing all the fields of the tables and the relationship amount the tables.
Chapter 7 Solutions
A Guide to SQL
Ch. 7 - What is a view?Ch. 7 - Which command creates a view?Ch. 7 - Prob. 3RQCh. 7 - What happens when a user retrieves data from a...Ch. 7 - What are three advantages of using views?Ch. 7 - Which command deletes a view?Ch. 7 - Prob. 8RQCh. 7 - Which command terminates previously granted...Ch. 7 - Prob. 10RQCh. 7 - How do you create an index? How do you create a...
Ch. 7 - Prob. 12RQCh. 7 - Does the DBMS or the user make the choice of which...Ch. 7 - Describe the information the DBMS maintains in the...Ch. 7 - The CUSTOMER table contains a foreign key,...Ch. 7 - Prob. 16RQCh. 7 - Prob. 17RQCh. 7 - Prob. 18RQCh. 7 - Prob. 19RQCh. 7 - When would you usually specify primary key...Ch. 7 - Prob. 21RQCh. 7 - Prob. 22RQCh. 7 - Prob. 23RQCh. 7 - Use SQL to make the following changes to the TAL...Ch. 7 - Create a view named ITEM_ORDER. It consists of the...Ch. 7 - Create a view named ORDER_TOTAL. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5TDCh. 7 - Perform the following tasks: a. Create an index...Ch. 7 - Delete the index named ITEM_INDEX3.Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9TDCh. 7 - Prob. 10TDCh. 7 - Toys Galore currently has a credit limit of 7,500....Ch. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named RESERVATION_CUSTOMER. It...Ch. 7 - Create a view named TRIP_INVENTORY. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5CATCh. 7 - Create the following indexes: a. Create an index...Ch. 7 - Prob. 7CATCh. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9CATCh. 7 - Ensure that the only legal values for the TYPE...Ch. 7 - Prob. 11CATCh. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named CONDO_OWNERS. It consists of...Ch. 7 - Create a view named CONDO_FEES. It consists of two...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5SCGCh. 7 - Prob. 6SCGCh. 7 - Delete the OWNER_INDEX 3 index from the OWNER...Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9SCGCh. 7 - Ensure that the only legal values for the BDRMS...Ch. 7 - Prob. 11SCG
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
How is the hydrodynamic entry length defined for flow in a pipe? Is the entry length longer in laminar or turbu...
Fluid Mechanics: Fundamentals and Applications
1.2 Explain the difference between geodetic and plane
surveys,
Elementary Surveying: An Introduction To Geomatics (15th Edition)
What is an uninitialized variable?
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
How does a computers main memory differ from its auxiliary memory?
Java: An Introduction to Problem Solving and Programming (8th Edition)
What output will the following lines of code display on the screen? cout "The works of Wolfgang\ninclude the f...
Starting Out with C++: Early Objects (9th Edition)
Look at the following description of a problem domain:
Starting Out with Java: From Control Structures through Data Structures (4th 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 do you create an index? How do you create a unique index? What is the difference between an index and a unique index?arrow_forwardWhat is the maximum number of PRIMARY KEY constraints allowed for a table? a. 1 b. 2 c. 30 d. 255arrow_forwardAdd a constraint to make sure the Rep_ID value entered in the BOOK_STORES table is a valid value contained in the STORE_REPS table. The Rep_ID columns of both tables were initially created as different datatypes. Does this cause an error when adding the constraint? Make table modifications as needed so that you can add the required constraint.arrow_forward
- In the initial creation of a table, if a UNIQUE constraint is included for a composite column that requires the combination of entries in the specified columns to be unique, which of the following statements is correct? a. The constraint can be created only with the ALTER TABLE command. b. The constraint can be created only with the table-level approach. c. The constraint can be created only with the column-level approach. d. The constraint can be created only with the ALTER TABLE MODIFY command.arrow_forwardExplain the difference between truncating a table and deleting a table.arrow_forwardWhich of the following characters can be used in a table name? a. b. ( c. % d. !arrow_forward
- Ensure that the only legal values for the BDRMS column in the CONDO_UNIT table are 1, 2, or 3.arrow_forwardProblems 2932 are based on the following query: SELECT CUS_CODE, MAX(LINE_UNITSLINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = '615' GROUP BY CUS_CODE; How would you rewrite the query to ensure that the index you created in Problem 31 is used?arrow_forwardHi triggers Update and using Xampp and this table: CREATE TABLE MEMBER(STUDENT_ID CHAR(6) NOT NULL,CLUB_CODE VARCHAR(4) NOT NULL,MEMBER_DATE DATE NOT NULL,MEMBER_POSITION VARCHAR(15) NOT NULL,MEMBER_ATTENDANCE CHAR(2) NOT NULL,PRIMARY KEY (STUDENT_ID,CLUB_CODE),FOREIGN KEY (STUDENT_ID) REFERENCES STUDENT (STUDENT_ID) ON DELETE RESTRICT ON UPDATE CASCADE,FOREIGN KEY (CLUB_CODE) REFERENCES CLUB (CLUB_CODE) ON DELETE RESTRICT ON UPDATE CASCADE); INSERT INTO MEMBER VALUES('100027','C201','2020-03-25','Secretary','12'),('100027','C202','2020-04-11','Member','11'),('100032','C201','2020-02-23','President','12'),('100050','C201','2020-03-25','Member','10'),('100132','C202','2020-04-11','Treasurer','10'),('100074','C203','2020-04-09','President','12'),('100074','C204','2020-04-25','Treasurer','12'),('100051','C204','2020-04-25','Member','9'),('100064','C207','2020-04-25','Vice…arrow_forward
- write it by the keyboard CREATE TABLE sales ( "year SMALLINT NOT NULL, "quarter' TINYINT NOT NULL, region VARCHAR (50) NOT NULL, vehicle VARCHAR (50) NOT NULL, quantity SMALLINT NULL, CONSTRAINT pri_sales PRIMARY KEY (year, quarter, region, vehicle)); e) Continuing with the preceding scenario, suggest a new non-clustered index to stop the query optimizers having to resort to a table scanarrow_forwardSubject: DatabaseWrite the SQL statements for following modification tasks: a) Add constraint to the table BORROWER named borrower_cardno_pk to create the attribute name as the primary key. b) Delete the column city from the table BORROWER c) Modify the column of "phone" in table BORROWER, change the data type into type of VARCHAR2 with length of 20.arrow_forwardDROP TABLE IF EXISTS Worker; CREATE TABLE Worker ( ); 0 INSERT ); WORKER_ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, FIRST NAME TEXT, LAST NAME TEXT, SALARY INTEGER (15), JOINING DATE DATETIME, DEPARTMENT CHAR (25) INTO Worker (WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) VALUES 'Arora', 100000, '14-02-20 09.00.00', 'HR'), (001, 'Monika', (002, 'Niharika', 'Verma' 80000, '14-06-11 09.00.00', 'Admin'), 'HR'), 'Admin'), Admin'), 'Account'), 'Kumar', 75000, '14-01-20 09.00.00', 'Account') DROP TABLE IF EXISTS Bonus; CREATE TABLE Bonus ( ); (003, 'Vishal' 'Singhal', 300000, '14-02-20 09.00.00', (004, 'Amitabh 'Singh', 500000, '14-02-20 09.00.00', (005, 'Vivek' 'Bhati', 500000, '14-06-11 09.00.00'. (006, 'Vipul', 'Diwan' 200000, '14-06-11 09.00.00', (007, 'Satish' (008, 'Geetika', 'Chauhan', 90000, '14-04-11 09.00.00', 'Admin'); WORKER_REF_ID INTEGER, BONUS AMOUNT INTEGER(10), BONUS_DATE DATETIME, FOREIGN KEY (WORKER_REF_ID) REFERENCES Worker (WORKER_ID) ON DELETE…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning
- Database 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 SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher: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
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY