易截截图软件、单文件、免安装、纯绿色、仅160KB

简单的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. UPDAT


相关文档:

SQL Server 2005时出现计数器错误


如果您在安装SQL Server 2005时出现计数器错误
点击开始-运行输入"cmd",确定后进入命令窗口,依次输入下面4条命令删除4个计数器:
unlodctr w3svc
unlodctr msftpsvc
unlodctr asp
unlodctr inetinfo
然后再依次输入下面4条命令重装4个计数器:
lodctr w3ctrs.ini
lodctr ftpctrs.ini
lodctr axperf.ini
lod ......

实现多行合并一行的SQL写法

[ORACLE]
项目中遇到一个需求,需要将多行合并为一行。
表结构如下:
NAME                            Null           ......

sql:存储过程,事务,out参数

CREATE proc [dbo].[proc_DeleteTemplet] (@templeId varchar(15),@errorMessage varchar(50) output)
as
begin
  declare @error int
  set @error =0
  begin tran
  delete from tc_templet_Head where fBillNo=@templeId
  set @error=@error+@@error
  delete from tc_templet_ ......

sql查询所有存储过程内容 利用游标和临时表


Use 数据库
DECLARE @ProcName varchar(50)
Create Table #tmpName(Content varchar(2000))
Create Table #tmp(ProcName varchar(2000),Content1 varchar(8000))
--定义一个游标
DECLARE SearchProc CURSOR FOR
--查询数据库中存储过程的名称,尽量去除系统PROC,可以根据crdate时间字段来寻找非系统PROC
select n ......

实现多行合并一行的SQL [MSSQL2005]写法

--1. 创建表,添加测试数据
CREATE TABLE tb(id int, [value] varchar(10))
INSERT tb SELECT 1, 'aa'
UNION ALL SELECT 1, 'bb'
UNION ALL SELECT 2, 'aaa'
UNION ALL SELECT 2, 'bbb'
UNION ALL SELECT 2, 'ccc'
--SELECT * from tb
/**//*
id value
----------- ----------
1 aa
1 bb
2 aaa ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号