简单的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
相关文档:
SELECT
(case when a.colorder=1 then d.name
--+'('+cast(h.value as nvarchar)+')'
else '' end)表名,
a.colorder 字段序号,
a.name 字段名,
isnull(g.[value],'') AS 字段说明,
(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end) 标识,
(case whe ......
1=1或者'a'='a'等等恒等式是T-SQL中表达true的方法。因为在T-SQL中没有true这样的关键
字或值,所以需要借助这些恒等式来表达true的概念。
相对的,同样可以使用1<>1或者1=2等来表达false。
在应用程式的安全性方面,使用这些式子是SQL注入的基本原理,所以在拼接SQL语句的时候要过滤各种各样的敏感字
符。
当然 ......
create table "user" (
id int identity,
constraint PK_USER prim ......
最近做了一网站,但是在外面访问太慢。本想找下原因。看看是程序原因还是数据库原因。在网上逛逛。看了一下数据库索引。现在总结一下。方便下次查看。本文比较基础是入门级别的。
首先,什么是索引?从BookOnline上search了一下:
&nbs ......
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_ ......