Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 4, Problem 2HOA
Explanation of Solution
Changing the SQL command
- In a Relational
Database , the Primary Key uniquely identifies a row in the table. - The Primary Key must be unique and can't be NULL.
- There should be only one Primary Key in a table...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
You have been told that you need to store the zip code for employees. Add a column to the EMPLOYEE table which will be used to store each employee’s zip code
Update two rows in the EMPLOYEE table and assign a zip code (must have a WHERE clause). (you MAY use 1 or 2 statements)
Write a query that includes each employee's last name, department name (not ID), and salary for each employee whose salary is less than the average for their department
Insert values in Nurse table you created in Q2
Nurse_id: Your roll no
NurseName: Your Name
Date of Birth: Null
An "Orders" table has 30 columns, and the report only needs the order total by date. Which transformation should you perform?
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
- How do you indicate that a column alias should be used?arrow_forwardWhich of the following characters can be used in a table name? a. b. ( c. % d. !arrow_forwardAdd a new row in the ORDERS table with the following data: Order# = 1023 and Customer# = 1009. Describe the error raised and what caused the error.arrow_forward
- Repeat Exercise 6, but this time use the EXISTS operator in your query.arrow_forwardAdd a new row in the ORDERS table with the following data: Order# = 1022, Customer# = 2000, and Order date = August 6, 2009. Describe the error raised and what caused the error.arrow_forwardWEEK SQL ASSIGNMENT Complete the following exercise: Alter your student table adding a new column called enroll_date using the datetime data type. Populate the new column (enroll_date) with the current date and time. Using your student table return the student first and last names concatenated with a space and then the enroll_date minus one month. Here is an example of the output: Name Date Jane Smith 2019-05-03 13:14:12 Tom Jones 2020-08-07 05:23:56 Using your student table return the month name for the enroll_date column. For example, if the enroll_date was 11-6-2019 then the month name would be June.arrow_forward
- Write a SELECT statement that returns the companyname,address, city and postalcode from the suppliers table wherethe suppliers ID is also in the products table. Order it by thesupplier id in descending order. (returns 29 Rows)arrow_forwardThe following table has been created: CREATE TABLE student table ( stud id NUMBER (6), last_name VARCHAR2 (20), first name VARCHAR2 (20), lunch num NUMBER (4) ) ; Which one of the following INSERT statements will fail? O INSERT INTO student table VALUES (143354, 'Roberts', 'Cameron', 6543); O INSERT INTO student_table (stud_id, last_name, lunch_num) VALUES (143354, Roberts, 6543, 'Cameron'); O INSERT INTO student_table (stud_id, last_name, first_name, lunch_num) VALUES (143354, 'Roberts', 'Cameron', 6543); O INSERT INTO student_table (stud_id, lunch_num, first_name, last_name) VALUES (143352, 6543, 'Cameron', 'Roberts');arrow_forwardWrite a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, you can group the result set by the EmailAddress and OrderID columns. In addition, you must calculate the order total from the columns in the OrderItems table. Write a second SELECT statement that uses the first SELECT statement in its FROM clause. The main query should return two columns: the customer�s email address and the largest order for that customer. To do this, you can group the result set by the EmailAddress column.arrow_forward
- Write a SELECT statement that returns two columns basedon the EMPLOYEES table. Contact, is the employeelastname and the first initial of the first name. The secondcolumn, Phone, is the homephone without the area code.Only return rows for those employees in the 206 areacode, sort the results by the last name.arrow_forwardUse LargeCO tables to complete this assignment. Write a stored procedure that adds a new employee to lgemployee table. Pass the field values to the procedure as parameters.Use parameters and a DECLARE statement to display employees that were hired in every decade beginning 1970. The program should return the statements similar to this:12 employees were hired between 1970 and 198019 employees were hired between 1980 and 1990etc. LageCo Table Code: CREATE TABLE lgbrand (brand_id numeric(4,0) NULL,brand_name VARCHAR(100) NULL,brand_type VARCHAR(20) NULL); CREATE TABLE lgproduct (prod_sku VARCHAR(15) NOT NULL,prod_descript VARCHAR(255) NULL,prod_type VARCHAR(255) NULL,prod_base VARCHAR(255) NULL,prod_category VARCHAR(255) NULL,prod_price NUMERIC(10,2) NULL,prod_qoh NUMERIC(10,0) NULL,prod_min NUMERIC(10,0) NULL,brand_id NUMERIC(4,0) NULL); CREATE TABLE lgvendor (vend_id NUMERIC(6,0) NOT NULL,vend_name VARCHAR(255) NULL,vend_street VARCHAR(50) NULL,vend_city VARCHAR(50) NULL,vend_state…arrow_forwardUse LargeCO tables to complete this assignment. Write a stored procedure that adds a new employee to lgemployee table. Pass the field values to the procedure as parameters. Use parameters and a DECLARE statement to display employees that were hired in every decade beginning 1970. The program should return the statements similar to this: 12 employees were hired between 1970 and 198019 employees were hired between 1980 and 1990etc. LageCo Table Code: CREATE TABLE lgbrand (brand_id numeric(4,0) NULL,brand_name VARCHAR(100) NULL,brand_type VARCHAR(20) NULL); CREATE TABLE lgproduct (prod_sku VARCHAR(15) NOT NULL,prod_descript VARCHAR(255) NULL,prod_type VARCHAR(255) NULL,prod_base VARCHAR(255) NULL,prod_category VARCHAR(255) NULL,prod_price NUMERIC(10,2) NULL,prod_qoh NUMERIC(10,0) NULL,prod_min NUMERIC(10,0) NULL,brand_id NUMERIC(4,0) NULL); CREATE TABLE lgvendor (vend_id NUMERIC(6,0) NOT NULL,vend_name VARCHAR(255) NULL,vend_street VARCHAR(50) NULL,vend_city VARCHAR(50) NULL,vend_state…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageDatabase 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
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
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
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr