Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 6, Problem 6HOA
A new table has been requested to support tracking automated emails sent to customers. Create the table and add data as described below.
- Tablename: email_log
- Columns: emailid (numeric), emaildate (datetime), customer# (numeric)
- Primary key: emailid column, define as an Identity Column
- Add the following data rows and display resulting rows (if any errors occur, explain why the error is expected)
-
- 1. Emaildate = current date, customer# = 1007
- 2. Emailid = specify to use the column default value, emaildate = current date, customer# = 1008
- 3. Emailid = 25, emaildate = current date, customer# = 1009
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
A new table has been requested to support tracking automated emails sent to customers. Create the table and add data as described below.• Tablename: email_log• Columns: emailid (numeric), emaildate (datetime), customer# (numeric)• Primary key: emailid column, define as an Identity Column• Add the following data rows and display resulting rows (if any errors occur, explain why the error is expected)1. Emaildate ¼ current date, customer# ¼ 10072. Emailid ¼ specify to use the column default value, emaildate ¼ current date, customer# ¼ 10083. Emailid ¼ 25, emaildate ¼ current date, customer# ¼ 1009
(refer to the tables in the JustLee Books database).
Assume you have these table
CREATE TABLE Student (studid Char(9) Primary Key,FirstName Varchar2(50) NOT NULL,LastName Varchar2(50) NOT NULL,Email Varchar2(50) NOT NULL UNIQUE,PhoneNumber Number(8) NOT NULL UNIQUE,DateOfBirth Date NOT NULL,GPA Number(1,2) NOT NULL);
CREATE TABLE Club (clubID Number(3) Primary Key,ClubName Varchar2(20) NOT NULL,studid Char(9) NOT NULL UNIQUE, Foreign key(studid) references Student(studid));
CREATE TABLE MemberOf (ClubID Number(3) Primary Key, Studid char(9), JoiningDate date, Foreign Key(ClubID) references club(clubID), Foreign Key(Studid) references Student(studid));
CREATE TABLE Activities (Actid Number(3) Primary Key,Acdt DATE NOT NULL,Place Varchar2(50) NOT NULL,durationNbHour Number NOT NULL);
CREATE TABLE Organize (actid Number(3) Primary Key, clubID Number(3), Fee Number(4,2), Foreign Key(actid) references Activities(Actid),Foreign Key(clubID) references MemberOf(ClubID));
Write in SQL queries to populate the above tables by inserting minimum 4…
Write an anonymous block which updates the .Physician table.(As you can not update the .Physician Table, you will have to create your own table based on the structure and contents of the Physician Table). Use named parameters to get values for Phys_ID, Phys_name, Phys_phone, and Phys_speciality. If the value for Phys_ID is in the Physician Table, Update the values of the remaining columns. If the Phys_ID is not in the Physician Table, INSERT a row into the Physician Table with those values.
- Hint: Use variables for each of the columns above and assign a named parameter to each of
them. Then use the variable in the rest of the block.
- Write a simple driver to test the block with a Phys_ID that is in the Physician Table and a
Phys_ID that is not in the Physician Table.
Physician Table
Phys_ID Phys_Name Phys_Phone Phys_Specialty
----------- ------------------------…
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
- Create a new table containing these four columns: Emp#, Lastname, Firstname, and Job_class. The table name should be EMPLOYEES. The Job_class column should be able to store character strings up to a maximum length of four, but the column values shouldn’t be padded if the value has less than four characters. The Emp# column contains a numeric ID and should allow a five-digit number. Use column sizes you consider suitable for the Firstname and Lastname columns.arrow_forward6. A new table has been requested to support tracking automated emails sent to customers.Create the table and add data as described below.• Tablename: email_log• Columns: emailid (numeric), emaildate (datetime), customer# (numeric)• Primary key: emailid column, define as an Identity Column• Add the following data rows and display resulting rows (if any errors occur, explainwhy the error is expected)1. Emaildate ¼ current date, customer# ¼ 10072. Emailid ¼ specify to use the column default value, emaildate ¼ current date,customer# ¼ 10083. Emailid ¼ 25, emaildate ¼ current date, customer# ¼ 1009arrow_forwardCREATE TABLE employees8(employee_id NUMBER(10) PRIMARY KEY,first_name VARCHAR(25) UNIQUE,last_name VARCHAR(25) UNIQUE,job_id NUMBER(3),salary NUMBER(6) NOT NULL,department_name VARCHAR2(20));CREATE TABLE jobs8(job_id NUMBER(3) PRIMARY KEY,job_title VARCHAR2(25),min_salary NUMBER(4)check(min_salary >=2900),max_salary NUMBER(6)check(max_salary<=100000)); CREATE TABLE departments8(department_id NUMBER(2) PRIMARY KEY,department_name VARCHAR2(30),location_name VARCHAR2(15) DEFAULT 'Istanbul'); how can I do this question according to these 3 tables ? Create a complex view that joining with three tables.arrow_forward
- 5.16 LAB - Delete rows from Horse table The Horse table has the following columns: ID - integer, auto increment, primary key RegisteredName - variable-length string Breed - variable-length string Height - decimal number BirthDate - date Delete the following rows: Horse with ID 5. All horses with breed Holsteiner or Paint. All horses born before March 13, 2013. ***Please ensure your answer is correct and that you keep a look out for any comments that I might write back to your answer if your question gives me errors***arrow_forwardThe view V_PAT_ADT_LOCATION_HX returns one row of information per bed stay. The column ADT_DEPARTMENT_ID is the ID of the bed's department. The column ADT_DEPARTMENT_NAME is that department's name. Two distinct departments can potentially share the same name. Which of the following queries would return exactly one row per department and display the name of the department? A. SELECT ADT_DEPARTMENT_ID, MIN(ADT_DEPARTMENT_NAME) FROM V_PAT_ADT_LOCATION_HX GROUP BY ADT_DEPARTMENT_ID B. SELECT MIN(ADT_DEPARTMENT_ID), ADT_DEPARTMENT_NAME FROM V_PAT_ADT_LOCATION_HX GROUP BY ADT_DEPARTMENT_ID C. SELECT 'ADT_DEPARTMENT_ID', ADT_DEPARTMENT_NAME FROM V_PAT_ADT_LOCATION_HX GROUP BY ADT_DEPARTMENT_ID D. SELECT ADT_DEPARTMENT_ID, 'ADT_DEPARTMENT_NAME' FROM V_PAT_ADT_LOCATION_HX GROUP BY ADT_DEPARTMENT_IDarrow_forward12.3 LAB - Create LessonSchedule table with FK constraints Two tables are created: Horse with columns: ID - integer, primary key RegisteredName - variable-length string Student with columns: ID - integer, primary key FirstName - variable-length string LastName - variable-length string Create the LessonSchedule table with columns: HorseID - integer with range 0 to 65 thousand, not NULL, partial primary key, foreign key references Horse(ID) StudentID - integer with range 0 to 65 thousand, foreign key references Student(ID) LessonDateTime - date/time, not NULL, partial primary key If a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically. If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically.arrow_forward
- 3.10 LAB - Update rows in Horse table The Horse table has the following columns: ID - integer, auto increment, primary key RegisteredName - variable-length string Breed - variable-length string, must be one of the following: Egyptian Arab, Holsteiner, Quarter Horse, Paint, Saddlebred Height - decimal number, must be ≥ 10.0 and ≤ 20.0 BirthDate - date, must be ≥ Jan 1, 2015 Make the following updates: Change the height to 15.6 for horse with ID 2. Change the registered name to Lady Luck and birth date to May 1, 2015 for horse with ID 4. Change every horse breed to NULL for horses born on or after December 22, 2016. 401682.2354678.qx3zqy7arrow_forwardCREATE TABLE MOVIE( mov_id int NOT NULL, mov_title varchar(255) NOT NULL, mov_releaseDate date, gen_id int NOT NULL, PRIMARY KEY (mov_id), FOREIGN KEY (gen_id) REFERENCES GENRE(gen_id) ); CREATE TABLE GENRE( gen_id int NOT NULL, PRIMARY KEY (gen_id), gen_name varchar(255) NOT NULL );EXTRACT YEAR. Using the tables above, create a query that returns all the rows from the movie table and displays the movie id, movie title, and movie’s release year (not the full date). Must provide screenshots of the resulting table.arrow_forwardBased on script below , answer question in photo CREATE TABLE DOCTOR(DOC_ID NUMBER(3),DOC_NAME VARCHAR2(9),DATEHIRED DATE,SALPERMON NUMBER(12),AREA VARCHAR2(20),SUPERVISOR_ID NUMBER(3),CHGPERAPPT NUMBER(3),ANNUAL_BONUS NUMBER(5),CONSTRAINT DOCTOR_DOC_ID_PK PRIMARY KEY (DOC_ID)); CREATE TABLE PATIENT(PT_ID NUMBER(3),PT_LNAME VARCHAR2(15),PT_FNAME VARCHAR2(15),PTDOB DATE,DOC_ID NUMBER(3),NEXTAPPTDATE DATE,LASTAPPTDATE DATE,CONSTRAINT PATIENT_PT_ID_PK PRIMARY KEY (PT_ID),CONSTRAINT PATIENT_DOC_ID_FK FOREIGN KEY(DOC_ID)REFERENCES DOCTOR); INSERT INTO DOCTOR VALUES(432, 'Harrison' , TO_DATE('05-DEC-94'), 12000,'Pediatrics', 100, 75, 4500);INSERT INTO DOCTOR VALUES(509, 'Vester' , TO_DATE('09-JAN-00'), 8100,'Pediatrics', 432, 40, null);INSERT INTO DOCTOR VALUES(389, 'Lewis' , TO_DATE('21-JAN-96'), 10000,'Pediatrics', 432, 40, 2250);INSERT INTO DOCTOR VALUES(504, 'Cotner' , TO_DATE('16-JUN-98'), 11500,'Neurology', 289, 85, 7500);INSERT INTO DOCTOR VALUES(235, 'Smith' ,…arrow_forward
- Add two columns to the EMPLOYEES table. One column, named EmpDate, contains thedate of employment for each employee, and its default value should be the system date. Thesecond column, named EndDate, contains employees’ date of termination. When I put this formal it says, line 2 has invalid identifier! Can you help me what I need to fix from line 2? alter table EMPLOYEES2add column EmpDate date = getdate(),add column EndDate;arrow_forward3.8 LAB - Create LessonSchedule table with FK constraints Two tables are created: Horse with columns: ID - integer, primary key RegisteredName - variable-length string Student with columns: ID - integer, primary key FirstName - variable-length string LastName - variable-length string Create the LessonSchedule table with columns: HorseID - integer with range 0 to 65 thousand, not NULL, partial primary key, foreign key references Horse(ID) StudentID - integer with range 0 to 65 thousand, foreign key references Student(ID) LessonDateTime - date/time, not NULL, partial primary key If a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically. If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically. Note: Table and column names are case sensitive in the auto-grader.arrow_forwardCreate LessonSchedule table with FK constraints Two tables are created: Horse with columns: ID - integer, primary key RegisteredName - variable-length string Student with columns: ID - integer, primary key FirstName - variable-length string LastName - variable-length string Create the LessonSchedule table with columns: HorseID - integer with range 0 to 65 thousand, not NULL, partial primary key, foreign key references Horse(ID) StudentID - integer with range 0 to 65 thousand, foreign key references Student(ID) LessonDateTime - date/time, not NULL, partial primary key If a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically. If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically. Note: Table and column names are case sensitive in the auto-grader.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:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY