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 18MC
You’re creating a new table consisting of three columns: Col1, Col2, and Col3. Col1 should be the primary key and can’t have any NULL values, and each entry should be unique. Col3 must not contain any NULL values either. How many total constraints do you have to create?
- a. 1
- b. 2
- c. 3
- d. 4
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
You’re creating a new table consisting of three columns: Col1, Col2, and Col3. Col1 should be the primary key and can’t have any NULL values, and each entry should be unique. Col3 must not contain any NULL values either. How many total constraints do you have to create? ( refer to the tables in the JustLee Books database).
a. 1
b. 2
c. 3
d. 4
Task 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 please
The Driver Relationship team realized that maintaining driver IDs is difficult and requested an automatic way of incrementing the value when a new driver is added. You need to make the changes on the table to automatically increment the DRIVER_ID. After the change, you need to insert the following driver:
First Name: Nursin
Last Name: Yilmaz
Driving License ID: 4141447
Start Date: 2021-12-28
Driving License Checked: True
Rating: 4.0
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 is adding a NOT NULL constraint to an existing table different from adding other types of constraints?arrow_forwardWhat is the difference between a PRIMARY KEY constraint and a UNIQUE constraint?arrow_forwardWhat is the difference between disabling a constraint and dropping a constraint?arrow_forward
- Which type of constraint can be used to make certain the category for a book is included when a new book is added to inventory?arrow_forwardA table can have a maximum of how many PRIMARY KEY constraints?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_forward
- herpever applicable 2. Title field in Instructor table should allow only Mr., Ms., Mrs., Dr., Prof. as values apply check constraintsarrow_forward3. What is a DEFAULT constraint?arrow_forwardWhen must you define constraints at the table level rather than the column level? ( refer to the tables in the JustLee Books database).arrow_forward
- Task 2: The Driver Relationship team wants to ensure that the all driving license IDs in the active drivers table have the length of 7. Alter the ACTIVE_DRIVERS table created in Chapter 8, Activity 1 to check the length of the DRIVER_DRIVING_LICENSE_ID. Add a CHECK to the ACTIVE_DRIVERS table to enforce a driver license length of 7. Test Query: SELECT DISTINCT(constraint_name) FROM information_schema.check_constraints WHERE constraint_schema = 'InstantRide' AND constraint_name = 'ACTIVE_DRIVERS_chk_1' Expected Results CONSTRAINT_NAME ACTIVE_DRIVERS_chk_1arrow_forwardGiven the following tables, there is a university rule preventing a student from enrolling in a new class if there is an unpaid fine. Please write a table-level CHECK constraint to implement the rule. */ create table Course (CourseID int primary key, CourseName varchar(50), InstructorID int, AcademicYear int, Semester smallint); create table Student (StudentID int primary key, LastName varchar (50), FirstName varchar (50), Email varchar(30), PhoneNumber varchar (20)); create table Enrollment (CourseID int references Course(CourseID), StudentID int references Student(StudentID), RegisterDate date, primary key (CourseID, StudentID)); create table Fine (StudentID int references Student(StudentID), IssueDate date, Amount money, PaidDate date primary key (StudentID, IssueDate));arrow_forwardThe 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.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