0% found this document useful (0 votes)
553 views15 pages

Final Squeueele

The document contains questions about SQL concepts like joins, aggregate functions, formatting numbers and dates, and SQL functions. It will help assess knowledge of basic to intermediate SQL topics.

Uploaded by

mamidi sudeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
553 views15 pages

Final Squeueele

The document contains questions about SQL concepts like joins, aggregate functions, formatting numbers and dates, and SQL functions. It will help assess knowledge of basic to intermediate SQL topics.

Uploaded by

mamidi sudeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

1.

How many tables may be included with a joint

A. Three

B. One

C. Two

D. All of the listed options

2. To produce a meaningful result set without any Cartesian products, what is the minimum number of
conditions that should appear in the WHERE clause of a four-table join?

Select one:

A. 3
B. 4
C. 2
D. 8

3. Given the following descriptions of the employees and jobs tables, which of the following scripts will
display each employee minimum and maximum salaries based on their job title?

EMPLOYEES Table:

Name Null? Type

EMPLOYEE ID NOT NULL NUMBER (6)

FIRST NAME VARCHAR2 (20)

LAST NAME NOT NULL VARCHAR2 (25)

EMAIL NOT NULL VARCHAR2 (25)

PHONE NUMBER VARCHAR2 (20)

HIRE DATE NOT NULL DATE

JOB ID NOT NULL VARCHAR2 (10)

SALARY NUMBER (8,2)

COMMISSION PCT NUMBER (2,2)

MANAGER ID NUMBER (6)

DEPARTMENT ID NUMBER (4)

JOBS Table:

Name Null? Type

JOB ID NOT NULL VARCHAR2 (10)


JOB TITLE NOT NULL VARCHAR2 (35)

MIN_SALARY NUMBER (6)

MAX_SALARY NUMBER (6)

Select one:

A. SELECT first name, last name, job_id, min_salary, max_salary FROM employees e FULL JOIN jobs
(job id):
B. SELECT e.first name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e
NATURAL JOIN jobs j USING (job.d);
C. SELECT e first name, e last name, e.job_id, j.min_salary. j.max_salary FROM employees e
NATURAL JOIN jobs
D. SELECT first name, last name, job_id, min_salary, max_salary FROM employees NATURAL JOIN
jobs,

4. The________ join the ANSI-standard syntax used to generate a Cartesian product.

Select one:

A. CROSS
B. ALL
C. NATURAL
D. FULL

5. In the relational model, relationships between relations or tables are created by using.

Select one:

A. candidate keys
B. composite keys
C. determinants
D. foreign keys (Right answer: )

6. What is another name for a simple join or an inner join?

Select one:

A. Outer Join
B. Self Join
C. Equijoin
D. Nonequijoin

7. Which of the following operators is/are typically used in a nonequijoin?

Select one:

A. OR
B. NOT
C. IN
D. >=, <=

8. Which syntax would be used to retrieve all rows in both the EMPLOYEES and DEPARTMENTS tables,
even when there is no match?

Select one:

A. Outer join
B. Inner join
C. Natural join
D. Self join

9. If table A has 10 rows and table B has 5 rows, how many rows will be returned if you perform a
Cartesian join on the table

Select one:

A. 10
B. 5
C. 15
D. 50

10. The_____ statement can be used to combine rows from two queries, returning only the rows that
appear in both sets

Select one:

A. INTERSECT
B. UNION
C. UNION ALL
D. UNION Intersect

11. To perform a valid outer join between DEPARTMENTS and EMPLOYEES to list departments without
employees, select the correct clause for the following select statement.

SELECT d.department name, e.last_name FROM employees e, departments d WHERE

Select one

A e.department_id(+) = d.department_id(+)

B e.department_id(+) = d.department_id

C e.department_id = d.department_id(+)
D e.department_id = d.department_id

12 A union query is which of the following

A. Combines the output from multiple queries and as one including the same number of columns
B. Combines the output from no more than two queries and does not include the same number of
column
C. Combines the output from no more than two queries and must include the same number of
column
D. Combined output from multiple queries and must include the same number of columns

13. Assume you are the intersect operator open to combine the result from 2 table with identical
structure customer and customer_2The customer table contends 10 rows While the customer_ 2 table
contents 7 row None of the customer appear in both the customer table as well as in customer_2 table
how many records are returned when using intersect operator?

A. 7

B. 17

C. None

D. 10

14 what happene when you create cartesian product ?

Select one:

A All rows from one table are joined to all rows of another table

B All rows that do not match in the WHERE claune are displaye

C No rows are returned as you entered wrong join-criteria

D The table is joined to itself, one column to the next column, exhausting all possibilities.

15 which two are true about aggregate function?

Select one or more:

A. You can use aggregate functions in any clause of a SELECT statement


B. can mix single row columns with aggregate functions in the column list of a SELECT statement
by grouping on the singles row and columns.
C. You can use aggregate functions only in the column list of the SELECT clause and in the WHERE
clause of a SELECT statement
D. You can pass column names, expressions, constants, or functions as parameters to an aggregate
function.
16. When do we use full outer join?

Select one:

A. tables have NULL values


B. want all unmatched data from one table
C. You want all matched data from both tables
D. want all unmatched data from both tables

17Which statement about joining tables with a non-equijoin is false?

Select one:

A. The columns being joined must have compatible data types


B. The number of join Condition
C. A WHERE clause must specify a column in one table that is compared To a column in second
Table.
D.

18. SELECT c.customer_id, o.order_id, o.order_date, p.product_name FROM customer c, curr_order o,


product p Where curr_order.customer_id AND o.product_id = p.product_id ORDER BY o.order_amount
This statement fails when executed. Which change will correct the problem?

Select one:

A. the ORDER AMOUNT column in the SELECT list


B. Use the table aliases instead of the table names in the WHERE clause
C. Remove the table aliases from the WHERE clause
D. Use the table name in the ORDER BY clause

19. Select test statements display 2000 in the format of “$2,000.00”

Select one or more

A. SELECT TO CHAR (2000, SN,NNN NN) FROM dual;


B. TO CHAR (2000, $#,###) FROM dual
C. SELECT TO CHAR (2000, $0,000.00) FROM dual;
D. SELECT TO CHAR (2000, $9,999,00) FROM dual;

20. SELECT (10/3)*3 FROM DUAL

Select one:

A. 10
B. 10.0
C. 9.99999999
D. 9.99999999999999999999999999999999999999

21. We refer to a join as a self-join when

Select one:
A. We are joining top and bottom rows
B. we are joining table to itself
C. we are using left and right join together
D. we are joining more than two tables

22. The INNER JOIN clause ______.

Select one:

A. returns all rows that have matching value in the field on which the 2 tables are joined
B. returns only the rows from the first table, which have non-matching values with the second
table in the fig joined
C. returns all rows from 2 tables
D. no rows are returned

*23. Which type of join is the following SQL?

SELECT CUSTOMER_T CUSTOMER ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM


CUSTOMER_T._ WHERE CUSTOMER_T CUSTOMER_ID = ORDER_T. CUSTOMER ID

Select one:

A. Equi-join
B. Natural join
C. Outer join
D. Cartesian join

*24. Which operator is not appropriate in the join condition of a non-equi join SELECT statement?

Select one:

A. Greater than or equal to operator


B. LIKE operator
C. IN operator
D. Equal operator

*25. A NATURAL JOIN is based on

Select one:

A. columns with the same datatype and width


B. tables with the same structure
C. columns with the same name and datatype
D. tables with the same name

26. The ID column in the CLIENT table that corresponds to the CLIENT_ID column of the ORDER table
contains null be displayed. Which type of join should you use to display the data?

Select one:

A. Self join
B. Nonequi-Join
C. Outer join
D. Equijoin

27. The _____ statement can be used to combine rows from two queries, returning only the rows that
appears in both sets

Select one:

A. INTERSECT
B. UNION
C. UNION ALL
D. UNION Intersect

28. To produce a meaningful result set without any Cartesian product what is the minimum number of
conditions that should Where clause of a four-table join?

Select one:

A. 3
B. 4
C. 2
D. 8

*29. You need to calculate the total of all salaries in the accounting department Which group function
should you use?

Select one:

A. COUNT
B. SUM
C. MAX
D. MIN

30. A new standard has been adopted in your department that all codes that contain only 3 characters
must have a dash (-) values appended to them. Which function can be used in your query to restrict the
data displayed to only those codes 3 characters?

Select one:

A. SUBSTR
B. LENGTH
C. RPAD
D. REPLACE

31. Which two statements correctly describe functions that are available in SOL?

Select one or more:

A. NVL2 returns the first non-null expression in the expression list


B. TRUNCATE rounds the column, expression, or value to n decimal places
C. DECODE translates an expression after comparing it to each search value
D. A.INSTR returns the numeric position of a named character

32. Which of the following statements gets the total value of the column 'Price in the 'Sales' table?

Select one:

A. SELECT ADD(Price) FROM Sales


B. SELECT SUM(Price) FROM Sales
C. SELECT TOTAL (Price) FROM Sales
D. SELECT SUM(Price) WHERE Sales

33. Which of the following SQL statements is correct?

Select one:

A. SELECT CustomerName, COUNT(CustomerName) FROM Orders GROUP BY CustomerName


B. SELECT CustomerName, CALACULATE (CustomerName) FROM Orders
C. SELECT CustomerName, COUNT(CustomerName) FROM Orders ORDER BY CustomerName
D. SELECT CustomerName, COUNT(CustomerName) FROM Orders

34. You are sorting data in a table in SELECT statement in descending order. The column you are sorting
on contains NULL, records, where will the NULL record appear?

Select one:

A. At the end of the list.


B. At the same location they are listed in the unordered table.
C. At the beginning of the list
D. In the middle of the list.

35. You would like to display the system date in the format "Monday, 01 June, 2001 Which SELECT
statement should you use?

Select one:

A. SELECT TO_CHAR(SYSDATE, 'FMDay, DD Month, YYYY) FROM dual;


B. SELECT TO_DATE(SYSDATE, FMDAY, DD Month, YYYY) FROM ;
C. SELECT TO_CHAR(SYSDATE, FM DY, DDD Month, YYYY)
D. SELECT TO_CHAR(SYSDATE, FMDD, DY Month, YYY) FROM dual;

36 Which function returns the date of given weekday that is greater than the given date?

Select one:

A. TO_DATE
B. LAST DAY
C. NEXT DAY
D. SYSDATE

37. SELECT ROUND(15 12,-1) FROM DUAL


Select one

A. 20
B. 15
C. 15.10
D. 16

38. Evaluate the SQL statement:

SELECT ROUND(45.953, -1), TRUNC(45.936, 2) FROM dual; Which values are displayed?

Select one:

A. 46 and 45
B. 50 and 45.93
C. 46 and 45.93
D. 50 and 45.9

*39. SELECT SIGN( abs(-15)*5) FROM DUAL

Select one:

A. 15
B. 1
C. -75
D. 75

40. You are using the single row function in a SELECT statement. Which function can best be categorized
as similar in function to an IF-THEN-ELSE statement?

Select one:

A. DECODE
B. ROWIDTOCHAR.
C. NEW TIME
D. SORT

41. Which of the following is a SQL aggregate function?

Select one:

A. LEFT
B. CAST
C. MIN
D. RIGHT

*42. Select HELLO || NULL || WORLD FROM QUAL

select 'hello'||null||'world' from dual;


Select one

A. NULL
B. HELLO
C. WORLD
D. HELLOWORLD

43. Examine the description of the STUDENTS table

STD ID NUMBER(4)

COURSE ID VARCHARD2(10)

START DATE DATE

END DATE DATE

Which two aggregate functions are valid on the START DATE column? (Choose two options)

Select one or more

A. AVG(start date, end date)


B. DMIN(start_date)
C. COUNT(start_date)
D. SUM(start_date)
It is possible to apply COUNT() and MIN() functions on the column with DATE data type.

45. Which two are character manipulation functions? (Choose two options)

Select one or more.

A. TRUNC
B. REPLACE
C. TO DATE
D. TRIM
46. You want to display the expiration date of the warranty for a product. Which SQL statement would
you execute?

Select one:

A. SELECT product_id, SYSDATE + warranty_period FROM product information


B. SELECT product_id, TO YMINTERVAL(SYSDATE + warranty period) FROM product information,
C. SELECT product_id, TO YMINTERVAL(warranty period) FROM product information;
D. SELECT product_id, TO YMINTERVAL (SYSDATE) + warranty period FROM product information

// here warranty period is not date but number of months (i.e. number)

47. Which two statements are true regarding the ORDER BY clause? (Choose two options)

Select one or more:

A. The ORDER BY clause is executed on the client side


B. The sort is in descending order by default
C. The ORDER BY clause comes last in the SELECT statement
D. The sort is in ascending order by default
48. The ITEM table contains these columns

ITEM ID NUMBER(9)

COST NUMBER(7,2)

RETAIL NUMBER(7,2)

The RETAIL and COST columns contain values greater than zero

Evaluate these two SQL statements:

1. SELECT item id. (retail * 1.25)+ 5.00- (cost *1.10)- (cost *.10) AS Calculated Profit FROM item;

2. SELECT item_id, retail *1.25 +5.00-cost* 1.10-cost*. 10 "Calculated “ FROM item;

What will be the result?

Select one:

A. One of the statements will not execute.


B. Statement 1 will display the Calculated Profit column heading.
C. Statement 1 and statement 2 will return the same value.
D. Statement 1 will return a higher value than statement 2.

49. The following SQL statement was written to retrieve the rows for the PRODUCT ID that has a UNT
PRICE more than 1,000 and has been ordered more than five times:

SELECT product id, COUNT(order id) total, unit price

FROM order items

WHERE unit price> 1000 AND COUNT(order id) >5

GROUP BY product id, unit price.

Which statement is true regarding this SQL statement?

Select one:

A. The statement would not execute because the aggregate function is used in the WHERE clause.
B. The statement would not execute because the WHERE clause should have the OR logical
operator instead of AND.
C. The statement would not execute because in the SELECT clause, the UNIT PRICE column is
placed after the column having the aggregate function.
D. The statement would execute and give you the desired result

50. Evaluate these two SQL statements:


SELECT last name, salary, hire date FROM EMPLOYEES ORDER BY salary DESC;

SELECT last name, salary, hire date FROM EMPLOYEES ORDER BY 2 DESC;

What is true about them?

Select one:

A. There is no need to specify DESC because the results are sorted in descending order by default
B. The two statements produce identical results.
C. The second statement returns a syntax error
D. The two statements can be made to produce identical results by adding a column alias for the
salary the second SQL statement

51. Given below is a list of functions and their purpose in random order.

Function Purpose

1)NVL a) Used for evaluating NOT NULL and NULL values 2)NULLIF b) Used to return the first non- null
values in a list of expressions

3)COALESCE c) Used to compare two expressions. If both are same, it returns NULL; otherwise, it returns
only the first expression.

4)NVL2 d) Used to convert NULL values to actual values Identify the correct combination of functions in
the usage.

Select one:

A. 1-d,2-b,3-c,4-a
B. 1-a,2-c,3-b.4-d
C. 1-b,2-c,3-d,4-a
D. 1-d,2-c,3-b,4-a

52. Evaluate this SQL statement:

SELECT c.customer_id, o.order_id, o.order_date, p.product_name FROM customer c, curr_order o,


product p WHERE customer.customer_id = curr_order.customer_id AND o.product_id = p.product_id
ORDER BY o order amount. This

statement fails when executed. Which change will correct the problem?

Select one:

A. Use the table name in the ORDER BY clause.


B. Use the table aliases instead of the table names in the WHERE clause.
C. Include the ORDER AMOUNT column in the SELECT list.
D. Remove the table aliases from the WHERE clause.

53. Which two statements are true regarding single row functions? (Choose two options)

Select one or more:


A. They can be used in SELECT, WHERE, and ORDER BY clauses.
B. They can modify the data type of the argument that is referenced.
C. They can be nested up to only two levels.
D. They can return multiple values of more than one data type.

54. The join column must be included in the select statement when you use the NATURAL JOIN clause,
State True False.

Select one:

A. True
B. False

55. You can use combination of GROUP BY clause, HAVING clause and WHERE clause SQL clauses in one
SQL

statement. State True or False.

Select one:

A. True
B. False

56. SELECT c.country.name, d.department name FROM countries c.departments d WHERE country_id (+)
- d.country.id (+)

State True or False.

Select one:

A. True
B. False

57. Find the odd one.

Select one:

A. date number
B. date+date
C. date-date
D. Date+number
MARKED FOR REVIEW: q 48,

You might also like