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

37 37725
Q:

A subquery in an SQL SELECT statement is enclosed in

A) [ ] B) { }
C) < > D) ( )
 
Answer & Explanation Answer: D) ( )

Explanation:

A subquery in an SQL SELECT statement is enclosed in parenthesis (...).

Report Error

View Answer Report Error Discuss

2 25436
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

17 16663
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

Filed Under: SQL
Job Role: IT Trainer , Database Administration , Analyst

6 14370
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

9 12875
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

Filed Under: SQL
Exam Prep: AIEEE , Bank Exams
Job Role: Analyst , Bank Clerk , Bank PO , Database Administration , IT Trainer

3 12235
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

7 10774
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

18 10166