简单的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
相关文档:
1
bigint
从 -2^63 到 2^63-1 之间的 integer (整数)数据
2
binary
定长的binary数据,最长为8,000字节
3
bit
integer数据,值为1或0
4
char ......
SQL语句的优化就是将性能较低的SQL语句转换达成同样目的性能优异的SQL语句
下面我们一起来看看一些可以优化SQL的方法,希望大家多提出意见我们共同学习或者是大家有什么好的优化方法可以提出来共享一下。
第一种优化(使用指定列代替”*”)
使用“*&rdquo ......
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 ......
情况:我以前安装过SQL Server 2000,哦,还有SQL Server 2005、MySQL呢,后来系统重装了,不过这些应用程序都在E盘里,不在系统盘里,就在安装的时候出现如下三个错误,在此逐个解决说明如下:
问题一:
报错信息:以前的某个程序安装已在安装计算机上创建挂起的文件操作。运行安装程序之前必须重新启动计算机。
解决方 ......
1. 使用的是服务器上的,不是本机的Oracle,按下面做就可以了:
设置环境变量:NLS_LANG,具体值用下面查询的值:
SELECT 'AMERICAN_AMERICA.' || PROPERTY_VALUE
from DATABASE_PROPERTIES
WHERE PROPERTY_NAME = 'NLS_CHARACTERSET';
2. 如果是本机的Oracle就需要在Oracle的安装目录下面改设置:
......