Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 3MC
Which of the following SQL statements is invalid and returns an error message?
- a. ALTER TABLE books ADD CONSTRAINT books_pubid_uk UNIQUE (pubid);
- b. ALTER TABLE books ADD CONSTRAINT books_pubid_pk PRIMARY KEY (pubid);
- c. ALTER TABLE books ADD CONSTRAINT books_pubid_nn NOT NULL (pubid);
- d. ALTER TABLE books ADD CONSTRAINT books_pubid_fk FOREIGN KEY (pubid) REFERENCES publisher (pubid);
- e. All of the above statements are invalid.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Draw the ERD
rI : ithat is implemented by the following SQL code:
CREATE TABLE PROJ_USER
USER_ID NUMBER NOT NULL,
USER_NAME VARCHAR2(50) NOT NULL,
USER_EMAIL VARCHAR2(50) NOT NULL,
CONSTRAINT USER_PK
PRIMARY KEY (USER_ID)
);
CREATE TABLE PROJ_CERTIFIEDUSER
USER_ID NUMBER NOT NULL,
CUSER_REALNAME VARCHAR2(50) NOT NULL,
CUSER_CERTIFICATION VARCHAR2(50) NOT NULL,
CONSTRAINT CERTIFIEDUSER_PK
PRIMARY KEY (USER_ID),
CONSTRAINT CERTIFIEDUSER_FK
FOREIGN KEY (USER_ID)
REFERENCES PROJ_USER (USER_ID)
);
Draw the ERD
that is implemented by the following SQL code:
CREATE TABLE PROJ_USER
USER_ID NUMBER NOT NULL,
USER_NAME VARCHAR2(50) NOT NULL,
USER_EMAIL VARCHAR2(50) NOT NULL,
CONSTRAINT USER_PK
PRIMARY KEY (USER_ID)
);
CREATE TABLE PROJ_CERTIFIEDUSER
USER_ID NUMBER NOT NULL,
CUSER_REALNAME VARCHAR2(50) NOT NULL,
CUSER_CERTIFICATION VARCHAR2(50) NOT NULL,
CONSTRAINT CERTIFIEDUSER_PK
PRIMARY KEY (USER_ID),
CONSTRAINT CERTIFIEDUSER_FK
FOREIGN KEY (USER_ID)
REFERENCES PROJ_USER (USER_ID)
);
THIS MODULE IS ABOUT SUBQUERIES, SO YOU MUST USE SUBQUERIES INSTEAD OF TABLE JOINS
(a) From which two fields in which table can you calculate the enrollment of a section?(b) From which table can you get both course and section numbers?(c) Which field in table SECTION uniquely identifies a section, section id or section no?(d) Write a SQL statement to show sections and their enrollment.(e) Write a SQL statement to show sections with enrollment greater than five. Display both course andsection numbers
Chapter 4 Solutions
Oracle 12c: SQL
Ch. 4 - What is the difference between a PRIMARY KEY...Ch. 4 - How can you verify the constraints that exist for...Ch. 4 - A table can have a maximum of how many PRIMARY KEY...Ch. 4 - Which type of constraint can be used to make...Ch. 4 - Which type of constraint should you use to ensure...Ch. 4 - How is adding a NOT NULL constraint to an existing...Ch. 4 - When must you define constraints at the table...Ch. 4 - Prob. 8RQCh. 4 - What is the difference between disabling a...Ch. 4 - Prob. 10RQ
Ch. 4 - Prob. 1MCCh. 4 - Which of the following is not a valid constraint...Ch. 4 - Which of the following SQL statements is invalid...Ch. 4 - What is the maximum number of PRIMARY KEY...Ch. 4 - Prob. 5MCCh. 4 - How many NOT NULL constraints can be created at...Ch. 4 - The FOREIGN KEY constraint should be added to...Ch. 4 - What is the maximum number of columns you can...Ch. 4 - Which of the following commands can you use to...Ch. 4 - Prob. 10MCCh. 4 - In the initial creation of a table, if a UNIQUE...Ch. 4 - Which type of constraint should you use on a...Ch. 4 - Which of the following commands can be used to...Ch. 4 - Which of the following keywords allows the user to...Ch. 4 - Which of the following data dictionary objects...Ch. 4 - Which of the following types of constraints cant...Ch. 4 - Suppose you created a PRIMARY KEY constraint at...Ch. 4 - You’re creating a new table consisting of three...Ch. 4 - Which of the following types of restrictions can...Ch. 4 - Which of the following is the valid syntax for...Ch. 4 - Prob. 1HOACh. 4 - Prob. 2HOACh. 4 - Prob. 3HOACh. 4 - Add a column named Base_salary with a datatype of...Ch. 4 - Create a table named BOOK_STORES to include the...Ch. 4 - Add a constraint to make sure the Rep_ID value...Ch. 4 - Change the constraint created in Assignment #6 so...Ch. 4 - Create a table named REP_CONTRACTS containing the...Ch. 4 - Produce a list of information about all existing...Ch. 4 - Issue the commands to disable and then enable the...
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
- Which of the following SQL statements is invalid and returns an error message? ( refer to the tables in the JustLee Books database). a. ALTER TABLE books ADD CONSTRAINT books_pubid_uk UNIQUE (pubid); b. ALTER TABLE books ADD CONSTRAINT books_pubid_pk PRIMARY KEY (pubid); c. ALTER TABLE books ADD CONSTRAINT books_pubid_nn NOT NULL (pubid); d. ALTER TABLE books ADD CONSTRAINT books_pubid_fk FOREIGN KEY (pubid) REFERENCES publisher (pubid); e. All of the above statements are invalidarrow_forwardT-SQL procedure for MICROSOFT SQL SERVER A: obtain the name and credit limit of the customer whose number currently is stored in I_CUSTOMER_NUM. Place these values in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. Output the content of I_CUSTOMER_NAME and I_CREDIT_LIMIT. HINT use cursor instructions as a template for the problem. Instructions goes as follows CREATE PROCEDURE usp_DISP_REP_CUST @repnum char(2) AS DECLARE@custnum char(3) DECLARE@custname char(35) DECLARE mycursor CURSOR READ_ONLY FOR SELECT CUSTOMER_NUM, CUSTOMER_NAME FROM CUSTOMER WHERE REP_NUM = @repnum OPEN mycursor FETCH NEXT FROM mycursor INTO @custnum, @custname WHILE @@FETCH_STATUS=0 BEGIN PRINT@custnum+' '+@custname FETCH NEXT FROM mycursor INTO @custnum, @custname END CLOSE mycursor DEALLOCATE mycursorarrow_forwardSELECT MAX(datediff(minute,start_time,end_time)) as "Longest_ride", MIN(datediff(minute,start_time,end_time)) as "shortest_ride" from RIDE LIMIT 0, 1000 Error Code: 1582. Incorrect parameter count in the call to native function 'datediff' 0.00034 sec How do I solve this SQL errorarrow_forward
- T-SQL procedure SQL SERVER ONLY A: obtain the name and credit limit of the customer whose number currently is stored in I_CUSTOMER_NUM. Place these valuse in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. Output the content of I_CUSTOMER_NAME and I_CREDIT_LIMIT.arrow_forwardord_no 70001 70009 70002 70004 purch_amt 150.5 270.65 65.26 110.5 ord_date customer_id salesman_id 2012-10-05 3005 2012-09-10 3001 2012-10-05 3002 2012-08-17 3009 5002 5005 5001 5003 Given the Orders Table above: Write a SQL statement to find the highest purchase amount with their ID and order date, for those customers who have a higher purchase amount in a day is within the range 100 and 300.arrow_forward//trying to make recursive SQL statement to get the days of the week , can you tell me what does not work in this query: WITH cte_number (counter, weekday) AS(SELECT 0, Datename(DW,0) UNION ALLSELECTcounter+1, Datename(DW, counter+1)FROM cte_numberwhere counter<6) select weekday from cte_number; //thanks for you assistancearrow_forward
- A cake shop named "Whisk" has an online presence. It has multiple flavors of cakes supplied by various vendors. The manager wants to know the cost of the available quantity. Write a sql query to get the total cost of the available cakes. Code should run on Mysql. Data type along with the sample input and output is mentioned below:- Cake: Column Type Cake_Id int Flavor varchar(100) Cost int Producer varchar(20) Stock int Sample Input :- Cake: Cake_id Flavor Cost Producer Stock 1001 Vanilla 450 Just bake 8 1003 Chocolate 500 Flower Aura 12 1004 Red velvet 600 Bakingo 1 1005 Strawberry 700 Bigbasket 2 1006 Cinnamon 900 Creamy 1 1007 Vanilla 900 Creamy 2 1008 Mango 900 Just bake 2 1009 Strawberry 550 Creamy 2 Sample output - 17200arrow_forwardExamine the EMPLOYEES table and the given SQL statement: EID Name Dept Salary 1001 Aminah IT 600 1002 Zainab Admin 400 1003 Tafal IT SELECT Name, Dept, Salary FROM employees WHERE name LIKE'_a%' AND salary IS NULL; Which of the following will be the output after executing the statément? a. Name Dept Salary Tafal IT b. Name Dept Salary Aminah IT 600 Zainab Admin 400 Name Dept Salary Zainab Admin 400 Name Dept Salary Aminah IT 600 DELLarrow_forwardI need SQL code for the following question: - Use MYSQL for coding Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer named 'number' that is the primary key and cannot be NULL. The second column is a variable length string named 'is_prime' with a maximum length of 50. Write one or more insert statements that fills only the 'number' column of table 'prime_test' with the integers between 2 and 100. Write one or more update statements that sets the 'is_prime' column for each associated integer. For a prime, the column should read 'prime'. For non-primes, the column should read 'composite'. Write a final select statement to return only the 'number' column from 'prime_test' for records that are prime, ordered from largest to smallest.arrow_forward
- Assistance 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_forwardpls help me: Write SQL queries to create tables with keys and relations corresponding to each of the following questionarrow_forwardSTAFF TABLE: STAFF TABLE: Staff No 101 102 103 Payslip Number sName 1011 1021 1031 Kylen Kim Jane Employment Date 2001/05/01 2001/05/02 2001/05/03 Salary 2000 4000 3000 • Formulate SQL statements to create a new Table called "TEMP_STAFF" which contains exact same information as "STAFF" table above and specify "Staff No" as Primary Key.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
How to Design DB Tables for any Application? (The Basics); Author: Studytonight;https://www.youtube.com/watch?v=XUdNVaSikqY;License: Standard YouTube License, CC-BY
Create a Table (Introduction to Oracle SQL); Author: Database Star;https://www.youtube.com/watch?v=BiV1IrzB1sY;License: Standard Youtube License