Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
thumb_up100%
Chapter 3, Problem 6MC
Which of the following commands creates a new table containing a virtual column?
- a. CREATE TABLE newt able AS (SELECT order#, title, quantity, retail FROM orders);
- b. CREATE TABLE newt able (price NUMBER (3), total NUMBER (8, 2));
- c. CREATE TABLE newt able (calc1 NUMBER (4), calc2 NUMBER (4);
- d. CREATE TABLE newt able (cola NUMBER (3), colb NUMBER (3),
cole AS (cola+colb));
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
with it, paste your code in a text file named Student.txt and save it in your
task folder.
Write the SQL code to create a table called Student. The table structure is
summarised in the table below (Note that STU_NUM is the primary key):
STU_NUM
Attribute Name
STU_SNAME
STU_FNAME
STU_INITIAL
STU_STARTDATE
COURSE_CODE
PROJ_NUM
STU STU_S STU_F STU_INITIAL
NUM NAME NAME
01
02
Snow John
E
CHAR(6)
After you have created the table in question 1, write the SQL code to enter
the first two rows of the table as below:
Stark Arya с
VARCHAR(15)
VARCHAR(15)
CHAR(1)
DATE
CHAR(3)
INT(2)
Data Type
STU_STARTDATE COURSE_ PROJ_
CODE
NUM
05-Apr-14
12-Jul-17
201
305
6
11
Assuming all the data in the Student table has been entered as shown
below, write the SQL code that will list all attributes for a COURSE_CODE of
305.
Which of the following is true? (refer to the tables in the JustLee Books database)a. If you truncate a table, you can’t add new data to the table.b. If you change the default value of an existing column, all existing rows containing a NULL value in the same column are set to the new DEFAULT value.c. If you delete a column from a table, you can’t add a column to the table with the same name as the previously deleted column.d. If you add a column to an existing table, it’s always added as the last column of the table.
Question Workspace
Which of the following statements is valid?
a. DROP table_name;
b. DELETE TABLE table_name;
c. UPDATE TABLE table_name SET col1 = new_value;
d. ALTER TABLE table_name MODIFY col1 CHAR(10);
e. All of the above.
f. None of the above.
Icon Key
Chapter 3 Solutions
Oracle 12c: SQL
Ch. 3 - Which command is used to create a table based on...Ch. 3 - Prob. 2RQCh. 3 - What guidelines should you follow when naming...Ch. 3 - What is the difference between dropping a column...Ch. 3 - Prob. 5RQCh. 3 - What happens to the existing rows of a table if...Ch. 3 - Explain the difference between truncating a table...Ch. 3 - Prob. 8RQCh. 3 - What happens if you try to decrease the scale or...Ch. 3 - Are a table and the data contained in the table...
Ch. 3 - Which of the following is a correct statement?
You...Ch. 3 - Prob. 2MCCh. 3 - Which of the following is not a correct...Ch. 3 - Which of the following is not a valid SQL...Ch. 3 - Which of the following is true? a. If you truncate...Ch. 3 - Which of the following commands creates a new...Ch. 3 - Which of the following commands drops any columns...Ch. 3 - Which of the following statements is correct?
A...Ch. 3 - Which of the following commands removes all data...Ch. 3 - Which of the following commands changes a table’s...Ch. 3 - Prob. 11MCCh. 3 - Which of the following is not a valid...Ch. 3 - Which of the following characters can be used in a...Ch. 3 - Which of the following is true?
All data in a...Ch. 3 - Prob. 15MCCh. 3 - Which of the following commands creates a new...Ch. 3 - Which of the following is a valid table name? a....Ch. 3 - Prob. 18MCCh. 3 - Which object in the data dictionary enables you to...Ch. 3 - Prob. 20MCCh. 3 - Create a new table containing the category code...Ch. 3 - Create a new table containing these four columns:...Ch. 3 - Add two columns to the EMPLOYEES table. One...Ch. 3 - Modify the Job_class column of the EMPLOYEES table...Ch. 3 - Prob. 5HOACh. 3 - Rename the EMPLOYEES table as JL_EMPS.
Ch. 3 - Create a new table containing these four columns...Ch. 3 - Prob. 8HOACh. 3 - Truncate the BOOK_PRICING table, and then verify...Ch. 3 - Delete the BOOK_PRICING table permanently so that...
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 statements would add a column job of type varchar 2 and size 20 to the already created Exhibition table? a. ALTER TABLE Exhibition add (job varchar2(20)); 1 b. ALTER TABLE Exhibition add column (job varchar2(20)); O c. ALTER TABLE Exhibition add job varchar2(20); O d. ALTER TABLE Exhibition add column (job); For a variable having value as str='BABY', what is the value of the function initcap(str) ? а. ВАBY b. Baby O . BABY O d. baby For name='Daniel, what is the output of the function rpad(name,8,'$') ? O a. Daniel 3 O b. $$Daniel O c. $$$$$$$$ O d. Daniel$$arrow_forwardThe CompanyDataSet contains a table named Sales and a field named Income. Which of the following loops will accumulate the values in the Income field? a. For Each row As CompanyDataSet.Sales.Row In CompanyDataSet.Sales.Rows Sales.Row += row.Income Next row b. For Each row As CompanyDataSet.Sales.Row In CompanyDataSet.Sales.Rows dblTotal += row.Income Next row c. For Each row As CompanyDataSet.Sales.Row In CompanyDataSet.Rows dblTotal += row.Income Next row d. For Each row As CompanyDataSet.Sales In CompanyDataSet.Sales.Rows dblTotal += row.Income Next rowarrow_forwardWhich of the following commands creates a new table containing two columns?a. CREATE TABLE newname (coll DATE, col2 VARCHAR2);b. CREATE TABLE newname AS (SELECT title, retail, cost FROM books);c. CREATE TABLEnewname (coll, col2);d. CREATE TABLE newname (coll DATE DEFAULT SYSDATE, col2 VARCHAR2 (1));arrow_forward
- 9. Write a SELECT statement that uses aggregate window functions to calculate the total due for all vendors and the total due for each vendor. Return 3 Columns: The vendor id from the Invoices table. The balance due (invoice_total-payment_total-credit_total) for each invoice in the invoices table with a balance greater than 0. The total balance due for all vendors in the Invoices table. Modify the column that contains the balance due for each vendor so it contains a cumulative total by balance due.arrow_forwardWhich of the following commands changes a table’s name from OLDNAME to NEWNAME?a. RENAME oldname TO newname;b. RENAME table FROM oldname TO newname;c. ALTER TABLE oldname MODIFY TO newname;d. CREATE TABLE newname (SELECT * FROM oldname);arrow_forwardAssignment Two: We will write three procedures on our tables, the first of which I have provided as an example. proclnsertPlayer takes one IN VARCHAR(16) paramater and returns an error code in the second SMALLINT (INOUT) parameter. The procedure checks the parameter and, if there are no errors, inserts the value into tblPlayers. Documentation of errors Condition Error code No errors 1st param Null or zero len playerID taken 1 proclnsertGame will receive two IN VARCHAR(16) interpreted asarrow_forward
- You have been instructed to add a new student information to the students table. Because the student is new, he has no marks before, you should not add an amount to the CGPA. The Students table contains these columns: Student_id NUMBER(10) Student_name VARCHAR2(30) Student phone NUMBER(10) CGPA NUMBER(2,2) Which INSERT statements will accomplish your objective? O a. INSERT INTO students VALUES (365, 'Khalil',99554721, 0 ) O b. INSERT INTO students VALUES (365, 'Khalil',99554721, 'NO CGPA' ) O c. INSERT INTO students VALUES (365, 'Khalil',99554721, NULL ) O d. INSERT INTO students VALUES (365, 'Khalil',99554721) Which line of code has an error? 1. CREATE TABLE FRUITS VEGETABLES 2. FRUIT TYPE VARCHAR2, 3. FRUIT NAME CHAR (20), 4. QUANTITY NUMBER (4)); O a. 1 O b. 2 O c. 3arrow_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_forwardLAB - Select horses with logical operators The Horse table has the following columns: • ID integer, primary key • RegisteredName - variable-length string • Breed - variable-length string • Height-decimal number • BirthDate - date Write a SELECT statement to select the registered name, height, and birth date for only horses that have a height between 15.0 and 16.0 (inclusive) or have a birth date on or after January 1, 2020.arrow_forward
- The INSERT statement needs to specify column names unless _____. -multiple rows are being inserted into the table with a single statement -only one row is being inserted into the table -the values are inserted in the same order as the table's columns -the values that are being inserted are for columns that are primary keysarrow_forwardWrite a SELECT statement that returns all rows with salary, last name, street address and ZIP code (SALARY, LAST_NAME, STREET, ZIP_CODE) from the EMPLOYEE and ADDRESS tables, sorted by SALARY from largest to smallest. STREET and ZIP_CODE are in the ADDRESS table, while the other fields are in the EMPLOYEE table. The common key is EMPLOYEE_ID.arrow_forwardWhich of the following commands is valid?a. RENAME customer# TO customernumber FROM customers;b. ALTER TABLE customers RENAME customer# TO customernum;c. DELETE TABLE customers;d. ALTER TABLE customers DROP UNUSED COLUMNS;arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY