收集的一些简单的SQL面试题

上一篇 / 下一篇  2007-05-29 10:56:50 / 个人分类:求职面试

1. Q. What is a join?
   A. Join is a process of retrieve pieces of data from different sets (tables) and returns them to the user or program as one joined collection of data.

2. Q. Can a table have more than one foreign key defined?
   A. A table can have any number of foreign keys defined. It can have only
       one primary key defined.

3. Q. List all the possible values that can be stored in a BOOLEAN data field.
   A. There are only two values that can be stored in a BOOLEAN data field:
         -1(true) and 0(false).
4.  Q. What is a stored procedure?
    A. A procedure is a group of PL/SQL statements that can be called by
        a name. Procedures do not return values they perform tasks.

5.  Q. What is Normalization?
    A. The process of table design is called normalization.

6.  Q. Write a SQL SELECT sample of the concatenation operator.
    A.  SELECT LastName ||',' || FirstName, City FROM Students;

7. Q. Is the WHERE clause must appear always before the GROUP BY clause in SQL SELECT ?

    A. Yes.
The proper order for SQL SELECT
clauses is: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY.
Only the SELECT and FROM clause are mandatory.

8. Q. Which operator do you use to return all of the rows
from one query except rows are returned in a second query?

    A. You use the MINUS operator to return all rows from one query except
where duplicate rows are found in a second query. The UNION operator
returns all rows from both queries minus duplicates. The UNION ALL operator
returns all rows from both queries including duplicates.
The INTERSECT operator returns only those rows that exist in both queries.

9. Q. Which of the following statements are Data Manipulation Language commands?
A. INSERT
B. UPDATE
C. GRANT
D. TRUNCATE
E. CREATE

    A.  A and B � The INSERT and UPDATE statements are
Data Manipulation Language (DML) commands.
GRANT is a Data Control Language (DCL) command.
TRUNCATE and CREATE are Data Definition Language (DDL) commands

10.   Q.  Describe some Group Functions that you know
A. 1) The COUNT function tells you how many rows were in the result set.
      SELECT COUNT(*) FROM TESTING.QA
    2) The AVG function tells you the average value of a numeric column.
       SELECT MAX(SALARY) FROM TESTING.QA
    3) The MAX and MIN functions tell you the maximum and minimum value of a numeric column.
       SELECT MIN(SALARY) FROM TESTING.QA 
     4) The SUM function tells you the sum value of a numeric column.
        SELECT SUM(SALARY) FROM TESTING.QA


TAG: SQL 面试 求职面试

 

评分:0

我来说两句

Open Toolbar