Table: S23NEWTABLE A) Code and execute a DDL statement which creates a table named S23NEWTABLE, with...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Table: S23NEWTABLE A) Code and execute a DDL statement which creates a table named S23NEWTABLE, with five attributes: Menultem, Name, Description, Price, SafeTemp, and Nutrition. a. Set the attribute Menultem as the primary key. b. Use reasonable datatypes and sizes, except make the Menultem a fixed character with a length of 8. B) Using ALTER TABLE, alter the table by adding another attribute - Vendor. Make the Vendor attribute a variable character datatype with a length of 20. C) Run a description of the S23NEWTABLE table (use the DESCRIBE command). D) Drop the table. Question 2. Table: S23ZIPCODE A) Using one SQL statement, create AND POPULATE a table called S23ZIPCODE containing columns ZipCode, and City. ZipCode should be generated. Follow these steps to walk through this SQL statement: 1 CREATE TABLE S23ZIPCODE AS ( 2 8 9 10 ); SELECT ROW_NUMBER() OVER(ORDER BY city) AS zipcode, FROM city (SELECT city FROM worker UNION SELECT supplier_city FROM food supplier) WHERE city IS NOT NULL Step 1: Use the "CREATE TABLE" format to create the table directly from the existing structure and data (see lecture slides on DDL). Step 2: Let us deconstruct the above SQL statement to understand what's happening: 2.1. ROW_NUMBER() is a function that assigns a unique number to each row to which it is applied (usually each row returned by the query). 2.2. We use the row numbers from the above discussed function to assign a unique zip code to each city. 2.3. The union of city from worker and supplier_city from food supplier should return all the cities used in our tables as depicted from line #4 to line # 8. But this UNION will also include NULL values. 2.4. The WHERE clause in line # 9 will remove all the NULL values. Step 3: Notice that you have now created a new table, called S23ZIPCODE from existing data in the database B) Provide the count of the number of rows in the new S23ZipCode table. There should be a count of 8 rows. Question 3. Table: S23STUDENT A. Create a table named S23STUDENT with the following columns and constraints: B. C. Column StudentID LastName FirstName Birthdate CareerID ZipCode Status GradYear Datatype/Size Char(9) VarChar2 (30) VarChar2 (30) Date Char(8) char(10) Char(2) Char(4) Constraints Primary Key (S23STUDENT_PK) Require that this field must be UNIQUE (S23student_UQ) Cannot be NULL Do a DESCRIBE on S23STUDENT to confirm your DDL was successful. To confirm the constraints, list the Constraint_Name, Constraint_Type, Status, and Search_Condition from the USER_CONSTRAINTS Oracle table where the Table_Name = 'S23STUDENT'. Display the SQL statement as well as the output. You don't have to write it, but review the difference between a constraint that you have named versus a constraint that is named automatically by Oracle. Question 4. A) Add a new column named Application Date to S23STUDENT. Use a "date" datatype. Question 5. Table: S23CAMPUS B) Describe S23STUDENT. (DESCRIBE to show table structure.) A) Code and execute a DDL statement which creates a table named S23CAMPUS, with five attributes: CampusID, CampusName, Zipcode, Website, and Email. Set the CampusID as the primary key (pk_S23campus). Use reasonable datatypes and sizes, except make the CampusID a fixed character with a length of 6) B) Run a description of the table (use the DESCRIBE command). Question 6. Add CampusID as a Foreign Key to S23STUDENT. A) First using ALTER TABLE, add CampusID to S23STUDENT using the same datatype and size as in the parent table (S23CAMPUS). B) Second, add a constraint called S23Student_FK establishing referential integrity between the CampusID in the S23Student (child) table and the S23Campus (parent) table. C) Describe S23STUDENT. Question 7. Add a check constraint for the Status attribute in the S23STUDENT A) Use the CHECK clause to limit the options to FR, SO, JR, or SR. Name the constraint: S23STUDENT_STATUS_CK B) Copy and execute the following statement to check the constraint for Status: GR'); Then copy and paste the error result as well as the SQL statement that you just used. You should have an ORA-01400: cannot insert NULL into as an error INSERT INTO S23student (studentid, status) VALUES ('PU3922', Question 8. Run a SQL statement that displays your userID (USER) and the system time stamp (SYSDATE) Select the USER and SYSDATE from the DUAL table Question 9. A) Using the USER_CONSTRAINTS Oracle table, list the Constraint_Name, Table_Name and Status from the USER_CONSTRAINTS view where the Constraint_Type = 'P' (i.e., Primary Key). Copy and paste the last ten lines to your document. B) List the Constraint_Name, Table_Name, R_Constraint_Name and Status from the USER_CONSTRAINTS view where the Constraint pe = 'R' (i.e., Foreign Key). The R_Constraint_Name is the parent's constraint name. Copy and paste the last ten lines to your document. Question 10. Drop S23ZIPCODE, S23STUDENT, and S23CAMPUS. Cascade the constraints. Show the SQL statement to drop the 3 tables as well as the output. DROP TABLE tablename CASCADE CONSTRAINTS; Table: S23NEWTABLE A) Code and execute a DDL statement which creates a table named S23NEWTABLE, with five attributes: Menultem, Name, Description, Price, SafeTemp, and Nutrition. a. Set the attribute Menultem as the primary key. b. Use reasonable datatypes and sizes, except make the Menultem a fixed character with a length of 8. B) Using ALTER TABLE, alter the table by adding another attribute - Vendor. Make the Vendor attribute a variable character datatype with a length of 20. C) Run a description of the S23NEWTABLE table (use the DESCRIBE command). D) Drop the table. Question 2. Table: S23ZIPCODE A) Using one SQL statement, create AND POPULATE a table called S23ZIPCODE containing columns ZipCode, and City. ZipCode should be generated. Follow these steps to walk through this SQL statement: 1 CREATE TABLE S23ZIPCODE AS ( 2 8 9 10 ); SELECT ROW_NUMBER() OVER(ORDER BY city) AS zipcode, FROM city (SELECT city FROM worker UNION SELECT supplier_city FROM food supplier) WHERE city IS NOT NULL Step 1: Use the "CREATE TABLE" format to create the table directly from the existing structure and data (see lecture slides on DDL). Step 2: Let us deconstruct the above SQL statement to understand what's happening: 2.1. ROW_NUMBER() is a function that assigns a unique number to each row to which it is applied (usually each row returned by the query). 2.2. We use the row numbers from the above discussed function to assign a unique zip code to each city. 2.3. The union of city from worker and supplier_city from food supplier should return all the cities used in our tables as depicted from line #4 to line # 8. But this UNION will also include NULL values. 2.4. The WHERE clause in line # 9 will remove all the NULL values. Step 3: Notice that you have now created a new table, called S23ZIPCODE from existing data in the database B) Provide the count of the number of rows in the new S23ZipCode table. There should be a count of 8 rows. Question 3. Table: S23STUDENT A. Create a table named S23STUDENT with the following columns and constraints: B. C. Column StudentID LastName FirstName Birthdate CareerID ZipCode Status GradYear Datatype/Size Char(9) VarChar2 (30) VarChar2 (30) Date Char(8) char(10) Char(2) Char(4) Constraints Primary Key (S23STUDENT_PK) Require that this field must be UNIQUE (S23student_UQ) Cannot be NULL Do a DESCRIBE on S23STUDENT to confirm your DDL was successful. To confirm the constraints, list the Constraint_Name, Constraint_Type, Status, and Search_Condition from the USER_CONSTRAINTS Oracle table where the Table_Name = 'S23STUDENT'. Display the SQL statement as well as the output. You don't have to write it, but review the difference between a constraint that you have named versus a constraint that is named automatically by Oracle. Question 4. A) Add a new column named Application Date to S23STUDENT. Use a "date" datatype. Question 5. Table: S23CAMPUS B) Describe S23STUDENT. (DESCRIBE to show table structure.) A) Code and execute a DDL statement which creates a table named S23CAMPUS, with five attributes: CampusID, CampusName, Zipcode, Website, and Email. Set the CampusID as the primary key (pk_S23campus). Use reasonable datatypes and sizes, except make the CampusID a fixed character with a length of 6) B) Run a description of the table (use the DESCRIBE command). Question 6. Add CampusID as a Foreign Key to S23STUDENT. A) First using ALTER TABLE, add CampusID to S23STUDENT using the same datatype and size as in the parent table (S23CAMPUS). B) Second, add a constraint called S23Student_FK establishing referential integrity between the CampusID in the S23Student (child) table and the S23Campus (parent) table. C) Describe S23STUDENT. Question 7. Add a check constraint for the Status attribute in the S23STUDENT A) Use the CHECK clause to limit the options to FR, SO, JR, or SR. Name the constraint: S23STUDENT_STATUS_CK B) Copy and execute the following statement to check the constraint for Status: GR'); Then copy and paste the error result as well as the SQL statement that you just used. You should have an ORA-01400: cannot insert NULL into as an error INSERT INTO S23student (studentid, status) VALUES ('PU3922', Question 8. Run a SQL statement that displays your userID (USER) and the system time stamp (SYSDATE) Select the USER and SYSDATE from the DUAL table Question 9. A) Using the USER_CONSTRAINTS Oracle table, list the Constraint_Name, Table_Name and Status from the USER_CONSTRAINTS view where the Constraint_Type = 'P' (i.e., Primary Key). Copy and paste the last ten lines to your document. B) List the Constraint_Name, Table_Name, R_Constraint_Name and Status from the USER_CONSTRAINTS view where the Constraint pe = 'R' (i.e., Foreign Key). The R_Constraint_Name is the parent's constraint name. Copy and paste the last ten lines to your document. Question 10. Drop S23ZIPCODE, S23STUDENT, and S23CAMPUS. Cascade the constraints. Show the SQL statement to drop the 3 tables as well as the output. DROP TABLE tablename CASCADE CONSTRAINTS;
Expert Answer:
Related Book For
Accounting Information Systems
ISBN: 978-0133428537
13th edition
Authors: Marshall B. Romney, Paul J. Steinbart
Posted Date:
Students also viewed these databases questions
-
Think about a job search you've conducted in the past. How did you learn about the jobs that were available? How is the job search process in Canada different from your previous country? How do you...
-
Public companies are required to disclose information about their governance structure, including information about their board of directors and its committees. Public companies also must disclose...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In an attempt to identify ecologically friendly methods for controlling mosquito populations, researchers conducted eld experiments in India where aquatic nymphs of the dragony Brachytron pretense...
-
Panel BC in Fig P2.76 is circular. Compute (a) The hydrostatic force of the water on the panel; (b) Its center of pressure; and (c) The moment of this force about point B. 50 3 m Water at 20C 3 m
-
Charity Navigator is America's leading independent charity evaluator. The following data show the total expenses ($), the percentage of the total budget spent on administrative expenses, the...
-
The Wide World of Fluids article titled "Where the Plume goes,". Air flows into the jet engine shown in Fig. P5.74 at a rate of 9 slugs/s and a speed of \(300 \mathrm{ft} / \mathrm{s}\). Upon...
-
Titan Mining Corporation has 8.5 million shares of common stock outstanding, 250,000 shares of 5 percent preferred stock outstanding, and 135,000 7.5 percent semiannual bonds outstanding, par value...
-
Dorothy (aged 17) has discovered that she is in 23 weeks pregnant. She is a Type-1 diabetic. Since a very young age, Dorothy has been devoutly religious. Part of her religion's doctrine is the belief...
-
What is the level of measurement for each of the following variables? a. Student IQ (intelligence quotient) ratings. b. Distances students travel to class. c. Student scores on the first statistics...
-
Solve the Fourier Transform of the function using the different Fourier Transform properties and pairs. g(t)= = 8 2-j3(t-2)
-
Question 3 VO Limited is a clothing manufacturer carrying on business in Hong Kong. Its profits and loss accounts for the year ended 30 June 2018 are as follows: Income Sales gross profits - sales to...
-
Chipotle has cash of $899 million, inventory of $35 million, total current assets of $1,175 million, and total current liabilities of $921 million on its latest balance sheet. Compute its quick ratio.
-
Identify the four steps of assessment. (4) 4. Name the cognitive levels achieved in the following instances: 4.1 Learners can define, describe, name and select. 4.2 Learners can deduce, give...
-
Lita Lopez started Biz Consulting, a new business, and completed the following transactions during its first year of operations. a. Lita Lopez invested $63,000 cash and equipment valued at $35,000 in...
-
There are 2 assets. Asset 1: Expected return 7.5%, standard deviation 9% Asset 2: Expected return 11%, standard deviation 12%, correlation with asset 1 is 0.4 You hold 30% of your portfolio in asset...
-
A project has the cash flows given in the table below. The project has required rate of return of 12.4 percent and Net Present Value (NPV) of -$96,700. Calculate the project's internal rate of return...
-
What kind of financial pressures can an LBO cause?
-
Sues Gallery sells original paintings by local artists. All sales occur in the store. Sometimes customers purchase more than one painting. Individual customers must pay for purchases in full at the...
-
This case involves creating a database from an integrated REA diagram and then using the REA diagram to guide the writing of queries to prepare financial statements. Required a. Create the tables...
-
A new program at Jones and Carter Corporation (JCC) was supposed to track customer calls. Unfortunately, the program took 20 minutes to load on a PC, and it crashed frequently. The project did not...
-
James Halperin, co-chair of Heritage Auctions, was interviewed about his experiences auctioning rare coins. Noting that when the auction house first opened in the 1970s, I used to proofread every...
-
An editorial on Bloomberg. com criticized President Bidens Buy American policy. The editorial argued that the . . . problem is that protectionism sets the US at odds with its international...
-
An article in the Wall Street Journal explained that despite rising national security tensions between the United States and China in 2023, trade between the two nations was rising. China is a...
Study smarter with the SolutionInn App