Question 1 See the following table CREATE TABLE product ( product_id NUMBER(3) PRIMARY KEY, product_name VARCHAR(30) NOT NULL, price NUMBER (3,2) CHECK (price > 0), quantity NUMBER(3) ); How many rows may the following statement return? (Hint: think about Primary Key's function) SELECT * FROM product WHERE product_id = 1023; Question 1 options: 1 or many 0 or 1 0 or many The statement returns an error. Question 2 Which of the following section in SELECT is mandatory ? Question 2 options: WHERE GROUP BY FROM ALL Question 3 See the following table CREATE TABLE product ( product_id NUMBER(3), product_name VARCHAR(30) NOT NULL, price NUMBER (3,2) CHECK (price > 0), quantity NUMBER(3) ); How many rows does the following statement return? SELECT * FROM product WHERE product_id = 1023; Question 3 options: 1 0 or 1 0 or many The statement returns an error.
I am having trouble finding these answers, it is using Oracle 12 in
Question 1
See the following table
CREATE TABLE product (
product_id NUMBER(3) PRIMARY KEY,
product_name VARCHAR(30) NOT NULL,
price NUMBER (3,2) CHECK (price > 0),
quantity NUMBER(3)
);
How many rows may the following statement return? (Hint: think about Primary Key's function)
SELECT *
FROM product
WHERE product_id = 1023;
Question 1 options:
1 or many |
|
0 or 1 |
|
0 or many |
|
The statement returns an error. |
Question 2
Which of the following section in SELECT is mandatory ?
Question 2 options:
WHERE |
|
GROUP BY |
|
FROM |
|
ALL |
Question 3
See the following table
CREATE TABLE product (
product_id NUMBER(3),
product_name VARCHAR(30) NOT NULL,
price NUMBER (3,2) CHECK (price > 0),
quantity NUMBER(3)
);
How many rows does the following statement return?
SELECT *
FROM product
WHERE product_id = 1023;
Question 3 options:
1 |
|
0 or 1 |
|
0 or many |
|
The statement returns an error. |
Question 4
See the following table
CREATE TABLE product (
product_id NUMBER(3) PRIMARY KEY,
product_name VARCHAR(30) NOT NULL,
price NUMBER (3,2) CHECK (price > 0),
quantity NUMBER(3) CHECK (quantity BETWEEN 0 AND 1000),
color_code NUMBER(2) UNIQUE
);
What is the possible maximum number of rows that the following statement can return?
SELECT *
FROM product
WHERE color_code >= 5 AND color_code < 10;
Question 4 options:
6 |
|
0 |
|
5 |
|
4 |
Question 5
IF a column alias contains a space or it is made of upper case and lower case letters, The alias must enclosed with (choose the best answer)
Question 5 options:
Ampersand symbol |
|
Single quotes |
|
Parenthesis |
|
Double Quotes |
Question 6
See the following table
CREATE TABLE product (
product_id NUMBER(3) PRIMARY KEY,
product_name VARCHAR(30) NOT NULL,
price NUMBER (3,2) CHECK (price > 0),
quantity NUMBER(3) CHECK (quantity BETWEEN 0 AND 1000),
color_code NUMBER(2) CHECK (color_code >= 0 and color_code < 3)
);
What is the possible maximum number of rows that the following statement can return?
SELECT *
FROM product
WHERE color_code > 3 AND color_code <= 7;
Question 6 options:
The statement returns an error. |
|
0 |
|
3 |
|
4 |
Question 7
IN SELECT statement you always add SELECT , FROM and WHERE keywords because without WHERE condition you wouldn't know which data you search
Question 7 options:
True |
|
False |
Question 8
What will the following statement return after execution?
SELECT employeenumber, lastname, email
FROM products
ORDER BY employeenumber DESC and email;
Question 8 options:
The results are sorted first numerically and then alphabetically. |
|
The results are sorted first numerically from high to low and then alphabetically. |
|
The results are sorted first alphabetically and then numerically. |
|
The query returns an error. |
Question 9
Which clause would you use in a SELECT statement to limit the display to those employees whose salary is greater than 5000?
Question 9 options:
ORDER BY SALARY > 5000 |
|
GROUP BY SALARY > 5000 |
|
WITH SALARY > 5000 |
|
WHERE SALARY > 5000 |
Question 10
What SQL keyword would you use to remove duplications within the result set.
Question 10 options:
DISTINCTION |
|
DISTINCT |
|
REMOVE DUPLICTAE |
|
NO DUPLICATE |
Question 11
Which clause would you add in the following SELECT statement to limit the rows to those customers whose credit is in the range 400 to 600 (We want to include 400 and 600 in the result)?
SELECT customer_id, customer_name
FROM customers;
Question 11 options:
WHERE credit_limit >= 600 and credit_limit <= 400 |
|
WHERE credit_limit <= 600 and credit_limit >= 400 |
|
WHERE credit_limit >= 600 or credit_limit <= 400 |
|
WHERE credit_limit <= 600 or credit_limit >= 400 |
Question 12
Which one is NOT TRUE about views
Question 12 options:
Views can be used for security purposes |
|
Views are same as tables hence they keep same records physically in the database and clone the underlined table data. |
|
Views are similar to table's two dimentional ros and columns look but they do not keep the data physically |
|
Views are named SQL objects meaning they are saved objects in the database based on given name to your query |
Question 13
Which of the following SQL statements is not valid?
Question 13 options:
SELECT orderdate when the order was submit FROM orders; |
|
SELECT orderdate as "when the order was submit" FROM orders; |
|
SELECT orderdate as whentheorderwassubmit FROM orders; |
|
all of the above |
Question 14
What value does the following SELECT statement returns?
SELECT 100*2 +50/5 FROM table;
Question 14 options:
50 |
|
25 |
|
210 |
|
1200 |
Step by step
Solved in 2 steps