简单的SQL面试题

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值