SQL Questions

Q:

Which operator performs pattern matching ?

A) LIKE operator B) EXISTS operator
C) BETWEEN operator D) None of these
 
Answer & Explanation Answer: A) LIKE operator

Explanation:

LIKE is a keyword that is used in the WHERE clause. Basically, LIKE allows us to do a search based operation on a pattern rather than specifying exactly what is desired (as in IN) or spell out a range (as in BETWEEN).

 

The syntax is as follows:
SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE {PATTERN}

 

{PATTERN} often consists of wildcards.

 

In SQL, there are two wildcards:


% (percent sign) represents zero, one, or more characters.

_ (underscore) represents exactly one character.

 

More :: Certification Questions on SQL

Report Error

View Answer Report Error Discuss

26 36623
Q:

Write an SQL Query find number of employees according to gender whose DOB is between 01/01/1960 to 31/12/1975.

Answer

SELECT COUNT(*), sex from Employees  WHERE  DOB BETWEEN ‘01/01/1960 ' AND ‘31/12/1975’  GROUP BY sex;

Report Error

View answer Workspace Report Error Discuss

Subject: SQL - Technology

15 15550
Q:

Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables ?

A) Data Manipulation Language(DML) B) Data Definition Language(DDL)
C) Both A & B D) None
 
Answer & Explanation Answer: B) Data Definition Language(DDL)

Explanation:

The Data Definition Language (DDL) is used to manage table and index structure.

CREATE,

ALTER,

RENAME,

DROP and

TRUNCATE

statements are the names of few data definition elements.

Report Error

View Answer Report Error Discuss

4 12368
Q:

Write an SQL Query to check whether date passed to Query is date of given format or not.

Answer

SQL has IsDate() function which is used to check passed value is date or not of specified format ,it returns 1(true) or 0(false) accordingly.


SELECT  ISDATE('1/08/13') AS "MM/DD/YY";


It will return 0 because passed date is not in correct format.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL - Technology

7 11889
Q:

find all Employee records containing the word "Joe", regardless of whether it was stored as JOE, Joe, or joe.

Answer

SELECT  * from Employees  WHERE  upper(EmpName) like upper('joe%');

Report Error

View answer Workspace Report Error Discuss

Subject: SQL - Technology

5 9846
Q:

Which of the following is a comparison operator in SQL?

A) = B) <>
C) ` D) /
 
Answer & Explanation Answer: A) =

Explanation:

The comparison operator that is used in SQL is '='. Comparison operators test whether two expressions are the same. Comparison operators can be used on all expressions except expressions of the text, ntext, or image data types.

Report Error

View Answer Report Error Discuss

1 9642
Q:

Write SQL Query to display current date?

Answer

The built in function called GetDate() returns the time stamp.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL - Technology

16 9529
Q:

A UNION query is which of the following?

A) Combines the output from multiple queries and does not include the same number of columns. B) Combines the output from multiple queries and must include the same number of columns.
C) Combines the output from no more than two queries and does not include the same number of columns. D) Combines the output from no more than two queries and must include the same number of columns.
 
Answer & Explanation Answer: B) Combines the output from multiple queries and must include the same number of columns.

Explanation:

A UNION query combines the output from multiple queries and must include the same number of columns.

Report Error

View Answer Report Error Discuss

2 6226