Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

MS SQL Êý¾ÝÀàÐÍ

 
1
bigint     
´Ó -2^63 µ½ 2^63-1 Ö®¼äµÄ integer (ÕûÊý)Êý¾Ý
2
binary       
¶¨³¤µÄbinaryÊý¾Ý£¬×Ϊ8,000×Ö½Ú
3
bit        
integerÊý¾Ý£¬ÖµÎª1»ò0
4
char      ......

SQLPLUS Ï¿ÉÒÔÏÔʾsqlÓï¾äÖ´ÐÐʱ¼äµÄÃüÁî

SET TIMING ON | OFF
SQL> set timing on
SQL> select * from emp where empno = 7369;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ----------- ---------- ----------
DEPTNO
----------
7369 SMITH CLERK ......

SQL WHERE 1=1

1=1»òÕß'a'='a'µÈµÈºãµÈʽÊÇT-SQLÖбí´ïtrueµÄ·½·¨¡£ÒòΪÔÚT-SQLÖÐûÓÐtrueÕâÑùµÄ¹Ø¼ü
×Ö»òÖµ£¬ËùÒÔÐèÒª½èÖúÕâЩºãµÈʽÀ´±í´ïtrueµÄ¸ÅÄî¡£
Ïà¶ÔµÄ£¬Í¬Ñù¿ÉÒÔʹÓÃ1<>1»òÕß1=2µÈÀ´±í´ïfalse¡£
ÔÚÓ¦ÓóÌʽµÄ°²È«ÐÔ·½Ã棬ʹÓÃÕâЩʽ×ÓÊÇSQL×¢ÈëµÄ»ù±¾Ô­Àí£¬ËùÒÔÔÚÆ´½ÓSQLÓï¾äµÄʱºòÒª¹ýÂ˸÷ÖÖ¸÷ÑùµÄÃô¸Ð×Ö
·û¡£
µ±È» ......

[SQL]SQLÐÔÄܵ÷ÓÅ

³õ¼¶Æª —— ¼òµ¥²éѯÓï¾äµÄµ÷ÓÅ ÀîÃ÷»Û , Èí¼þ¹¤³Ìʦ, IBM­
ÀîÃ÷»Û£¬ÔÚ IBM ÖйúÈí¼þ¿ª·¢ÖÐÐÄ Data Studio ÍŶӹ¤×÷´ÓÊ InfoSphere Warehouse Administration Console µÄ¹¦ÄܲâÊÔ¹¤×÷¡£ÔøÔÚ developerWorks ·¢±í¡¶½« DB2 DWE 9.1.X Ç¨ÒÆµ½ DB2 Warehouse 9.5¡·¡¢¡¶InfoSphere Warehouse SQL ²Ö´¢ÃüÁîÐнӿ ......

ʵÏÖ¶àÐкϲ¢Ò»ÐеÄ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ºÅ