Basic SQL

Description

Basic SQL
Brandon Gagon
Quiz by Brandon Gagon, updated more than 1 year ago
Brandon Gagon
Created by Brandon Gagon over 6 years ago
117
0

Resource summary

Question 1

Question
The SQL command that enables you to make changes in the data is ____.
Answer
  • INSERT
  • SELECT
  • COMMIT
  • UPDATE

Question 2

Question
To list all the contents of the PRODUCT table, you would use ____.
Answer
  • LIST * FROM PRODUCT
  • SELECT * FROM PRODUCT
  • DISPLAY * FROM PRODUCT
  • SELECT ALL FROM PRODUCT

Question 3

Question
Which command would you use when making corrections to the PRODUCT table?
Answer
  • CHANGE PRODUCT SET P_INDATE = '01/18/2004' WHERE P_CODE = '13-Q2/P2';
  • ROLLBACK PRODUCT SET P_INDATE = '01/18/2004' WHERE P_CODE = '13-Q2/P2';
  • EDIT PRODUCT SET P_INDATE = '01/18/2004' WHERE P_CODE = '13-Q2/P2';
  • UPDATE PRODUCT SET P_INDATE = '01/18/2004' WHERE P_CODE = '13-Q2/P2';

Question 4

Question
Which command is used to select partial table contents?
Answer
  • SELECT <column(s)> FROM <Table name> WHERE <Item>;
  • LIST <column(s)> FROM <Table name> WHERE <Conditions>;
  • SELECT <column(s)> FROM <Table name> WHERE <Conditions>;
  • LIST<column(s)> FROM <Table name> WHERE <Item>;

Question 5

Question
Which query will output the table contents when the value of V_CODE is less than or equal to 21344?
Answer
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE <> 21344;
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE <=21344;
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE => 21344;
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344;

Question 6

Question
What is the SQL syntax requirement to list the table contents for either V_CODE = 21344 or V_CODE = 24288?
Answer
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE <= 24288
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE => 24288
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE > 24288
  • SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE = 24288

Question 7

Question
What is the command used to list the P_CODE, P_DESCRIPT, P_INDATE, and P_PRICE fields from the Product table in ascending order by P_PRICE?
Answer
  • SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT SEQUENCE BY P_PRICE;
  • SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT LIST BY P_PRICE;
  • SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ORDER BY P_PRICE;
  • SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ASCENDING BY P_PRICE;

Question 8

Question
The basic SQL aggregate function that gives the number of rows containing not null values for the given column is ____.
Answer
  • COUNT
  • MIN
  • MAX
  • SUM

Question 9

Question
What is the command to join the P_DESCRIPT and P_PRICE fields from the PRODUCT table and the V_NAME, V_AREACODE, V_PHONE, and V_CONTACT fields from the VENDOR table where the value of V_CODE match?
Answer
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE <> VENDOR.V_CODE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE <= VENDOR.V_CODE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE => VENDOR.V_CODE;

Question 10

Question
What is the command to join the P_DESCRIPT and P_PRICE fields from the PRODUCT table and the V_NAME, V_AREACODE, V_PHONE and V_CONTACT fields from the VENDOR table, where the value of V_CODE match and the output is ordered by the Price?
Answer
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE <> VENDOR.V_CODE; ORDER BY P_PRICE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE => VENDOR.V_CODE; ORDER BY P_PRICE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE <= VENDOR.V_CODE; ORDER BY P_PRICE;
  • SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE; ORDER BY P_PRICE;

Question 11

Question
To delete a row from the PRODUCT table, use the ____ command.
Answer
  • KILL
  • DELETE
  • COMMIT
  • ERASE

Question 12

Question
ANSI-standard SQL allows the use of special operators in conjunction with the WHERE clause. A special operator used to check whether an attribute value is null is ____.
Answer
  • BETWEEN
  • IS NULL
  • LIKE
  • IN

Question 13

Question
The ____ command is used to modify the table by deleting a column.
Answer
  • DROP
  • ALTER
  • DELETE
  • ERASE

Question 14

Question
The ____ function is used to find the highest value in a table column.
Answer
  • MAX
  • TOTAL
  • SUM
  • TOP

Question 15

Question
UPDATE tablename ***** [WHERE conditionlist]; What command replaces the ***** in the above statement?
Answer
  • SET columnname = expression
  • columnname = expression
  • expression = columnname
  • LET columnname = expression

Question 16

Question
If you wish to perform an inner join based on only one common attribute, you might use the ____ clause.
Answer
  • OF
  • USING
  • HAS
  • JOIN ON

Question 17

Question
In a subquery, which query is executed first?
Answer
  • Leftmost
  • Rightmost
  • Innermost
  • Outermost
Show full summary Hide full summary

Similar

Periodic Table
Luke423
Aggression mind-map for A2 AQA Psychology
poeticjustice
Periodicity
hanalou
Chemistry Equations / Maths
Georgia B
The structure of the Heart, AS Biology
mill-bill
Edexcel Additional Science Chemistry Topics 1+2
Amy Lashkari
Physics P2
Emmakatewilsonx
Revision Timetable
stacey.henwood19
Frankenstein Key Quotes
michelle.lau
Matematica para concursos
Luiz Ricardo Oliveira
An Inspector Calls - Quotes and Context
James Holder