Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¾«ÃîSQLÓï¾ä


ÏÂÁÐÓï¾ä²¿·ÖÊÇMssql
Óï¾ä£¬²»¿ÉÒÔÔÚaccess
ÖÐʹÓá£
SQL
·ÖÀࣺ
DDL—
Êý¾Ý¶¨ÒåÓïÑÔ(CREATE
£¬ALTER
£¬DROP
£¬DECLARE)
DML—
Êý¾Ý²Ù×ÝÓïÑÔ(SELECT
£¬DELETE
£¬UPDATE
£¬INSERT)
DCL—
Êý¾Ý¿ØÖÆÓïÑÔ(GRANT
£¬REVOKE
£¬COMMIT
£¬ROLLBACK)
Ê×ÏÈ,
¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1
¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2
¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3
¡¢ËµÃ÷£º±¸·Ýsql server
---
´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk',
'testBack', 'c:\mssql7backup\MyNwind_1.dat'
---
¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4
¡¢ËµÃ÷£º´´½¨Ð±í
create table tabname(col1 type1 [not null] [primary key],col2
type2 [not null],..)
¸ù¾ÝÒÑÓÐµÄ±í´´½¨ÐÂ±í£º
A
£ºcreate table tab_new like tab_old (
ʹÓÃ¾É±í´´½¨Ð±í)
B
£ºcreate table tab_new as select col1,col2… from tab_old
definition only
5
¡¢ËµÃ÷£ºÉ¾³ýбídrop table tabname
6
¡¢ËµÃ÷£ºÔö¼ÓÒ»¸öÁÐ
Alter table tabname add column col type
×¢£ºÁÐÔö¼Óºó½«²»ÄÜɾ³ý¡£DB2
ÖÐÁмÓÉϺóÊý¾ÝÀàÐÍÒ²²»Äܸı䣬ΨһÄܸıäµÄÊÇÔö¼Óvarchar
ÀàÐ͵ij¤¶È¡£
7
¡¢ËµÃ÷£ºÌí¼ÓÖ÷¼ü£º Alter table tabname add primary key(col)
˵Ã÷£ºÉ¾³ýÖ÷¼ü£º Alter table tabname
drop primary key(col)
8
¡¢ËµÃ÷£º´´½¨Ë÷Òý£ºcreate [unique] index idxname on tabname(col….)
ɾ³ýË÷Òý£ºdrop index idxname
×¢£ºË÷ÒýÊDz»¿É¸ü¸ÄµÄ£¬Ïë¸ü¸Ä±ØÐëɾ³ýÖØн¨¡£
9
¡¢ËµÃ÷£º´´½¨ÊÓͼ£ºcreate view viewname as select statement
ɾ³ýÊÓͼ£ºdrop view viewname
10
¡¢ËµÃ÷£º¼¸¸ö¼òµ¥µÄ»ù±¾µÄsql
Óï¾ä
Ñ¡Ôñ£ºselect * from table1
where
·¶Î§
²åÈ룺insert into
table1(field1,field2) values(value1,value2)
ɾ³ý£ºdelete from table1 where
·¶Î§
¸üУºupdate table1 set
field1=value1 where
·¶Î§
²éÕÒ£ºselect * from table1
where field1 like ’%value1%’ ---like
µÄÓï·¨ºÜ¾«Ã²é×ÊÁÏ!
ÅÅÐò£ºselect * from table1
order by field1,field2 [desc]
×ÜÊý£ºselect count * as
totalcount from table1
ÇóºÍ£ºselect sum(field1) as
sumvalue from table1
ƽ¾ù£ºsel


Ïà¹ØÎĵµ£º

ms sql ³£ÓòÙ×÷Óï¾ä

MS SQLµÄһЩ¾­µä³£ÓòÙ×÷Óï¾ä»ã×Ü  ¡¾http://hi.baidu.com/kychen88/blog/item/b3c8e7d960821b3c32fa1cee.html¡¿
1.°´ÐÕÊϱʻ­ÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.Êý¾Ý¿â¼ÓÃÜ:
select encrypt('ԭʼÃÜÂë')
select pwdencrypt('ԭʼÃÜÂë')
select pwdcomp ......

SQL Server BI Step by Step SSIS 7 (End)

ºÍÆäËü³ÌÐòÒ»Ñù£¬SSIS°üͬÑùÐèÒª½¡×³£¬Îȶ¨µÄÔËÐУ¬ÕâÑùµÄ³ÌÐò²ÅÓпɿ¿ÐԺͿÉÉìËõÐÔ¡£SSISÌṩÁËÈçÏ·½ÃæµÄÖ§³Ö:
        1.ÊÂÎñ: ¿ÉÒÔ¶ÔÒ»¸ö³ÌÐò°üÉèÖóÉÒ»¸ö»òÕ߶à¸öÊÂÎñ£¬ÉõÖÁ¿ÉÒÔ¶ÔÁ½¸ö³ÌÐò°üÉèÖóÉÒ»¸öÊÂÎñ¡£ÎªÁ˱£Ö¤Êý¾ÝµÄÒ»ÖÂÐÔ£¬Ä㻹¿ÉÒÔDTCÊÂÎñ»òÕßSQL ServerÒýÇ漶µÄÊÂÎñ¡£ ......

ÇÉÓÃSQL ServerÈÕÆÚÀàÐÍÊý¾Ý¶þ½øÖÆÊä³ö¼ÆËãʱ¼ä²î

1¡¢SQL ServerÈÕÆÚÊý¾Ý¿âÄÚ²¿±íʾ¼°²éѯÊä³ö£º
SQL ServerÄÚ²¿¶ÔDateTimeÀàÐ͵ıíʾÊÇÓÃ8¸ö×Ö½ÚÀ´±íʾ£¬ÆäÖÐÇ°4¸ö×Ö½Ú±íʾµÄÊýֵΪ×Ô1900Äê1ÔÂ1ÈÕÁãʱÒÔÀ´µÄÌìÊý£¬ºóËĸö×Ö½ÚÊÇÌìÊýÖ®ÍâµÄÓжàÉÙ¸ö1/300Ã룬ÕâҲ˵Ã÷SQL ServerÄÚ²¿±íʾʱ¼äµÄ¾«¶ÈΪ1/300Ã룬Լ3.3ºÁÃë¡£
³£¹æµÄSQL²éѯ£¬Õý³£ÈÕÆÚÊä³ö¸ñʽΪ:yyyy-MM-dd hh: ......

sqlÓÅ»¯É¨Ã¤

1.oracleɨÃèµÄ˳ÐòΪ´Óϵ½ÉÏ£¬´ÓÓÒµ½×ó
           ËùÒÔÎÒÃÇÒª¾¡¿ÉÄܵİÑÊý¾ÝÉٵıí·ÅÔÚºóÃ棬½»²æ±í·ÅÔÚºóÃ棬×îÄܹýÂ˵ÄÌõ¼þ·ÅÔÚºóÃæ
2.²»ÒªÔÚË÷ÒýÉÏʹÓüÆËãºÍnot²Ù×÷·û
           Ë÷ÒýÒ»µ©²ÎÓë¼ÆËã»òÊ¹Ó ......

Sqlite3³£ÓÃSQLÓï¾ä×ܽᣬһÊÇ·ÀÖ¹×Ô¼ºÍüÁË£¬¶þÊÇ·ÖÏí

ÎÄÖеÄSQL¶¼ÊÇ´ÓÎÒµÄÏîÄ¿ÖÐÖ±½Ócopy¹ýÀ´£¬Òò´ËºÜ¶à±íÃûʲô¶¼ÓÐÁË
//´´½¨±í
"CREATE TABLE FEED_TABLE(FeedID TEXT, Title TEXT, Summary TEXT, Author TEXT, ImageName VARCHAR(21), ImageType TEXT, MaxIndex INT, ImageData BLOB)"
//²éѯ¼Ç¼
"select * form 'table_name'"
"select * form 'table name' where val ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ