Oracle quiz1

 



Q1.Write a query that retrieves suppliers that work in either Georgia or California.

SELECT * 
FROM supplier 
WHERE state in ('Georgia', 'California')

Q2.Write a query that retrieves suppliers with the characters "wo" and the character "I" or "i" in their name.

SELECT 
FROM supplier 
WHERE supplier_name LIKE '%wo%' 
AND ( supplier_name LIKE '%I%' OR supplier_name LIKE '%i%' )

Q3.Write a query that retrieves suppliers on which a minimum of 37,000 and a maximum of 80,000 was spent.

SELECT 
FROM supplier 
WHERE total_spent 
BETWEEN 37000 AND 80000

Q4.Write a query that returns the supplier names and the state in which they operate meeting the following conditions:

belong in the state Georgia or Alaska
the supplier id is 100 or greater than 600
the amount spent is less than 100,000 or the amount spent is 220,000
SELECT supplier_name, state
FROM supplier
WHERE state IN('Georgia', 'Alaska')
AND (supplier_id = 100 OR supplier_id > 600)
AND(total_spent < 100000 OR total_spent = 220000)


Q5.TRUE or FALSE Question:
The keywords such as SELECT and WHERE must always be capital in the SQL Query.

F

Q6.TRUE or FALSE Question:
The database works on first processing the filtering conditions and then processes the FROM condition.

F

Q7.TRUE or FALSE Question:
Having just the filter condition shown below in a SQL query will return all of the records from the table.
WHERE 1 = 1
T

Q8.TRUE or FALSE question:
NULL can not be compared using an equal sign.

T

Q9.TRUE or FALSE question:
The ORDER BY clause is processed before the FROM clause in a SQL statement and it's used to sort the columns in an ascending or descending fashion.

F

0 Comments:

張貼留言