Êý¾Ý¿âsqlµÄÌØÊâ×Ö·û£º
Êý¾Ý¿âsqlµÄÌØÊâ×Ö·û£º
1£©µ¥ÒýºÅ’£ºÀýÈçstring a = “this is marry’s book.”;
ʹÓÃinsertʱ¾Í»á³ö´í¡£
½â¾ö£ºa= a.Replace("'","''");
2£©°Ù·ÖºÅ% £ºÀýÈçstring a = “50%”;
ʹÓÃlike²éѯ£¬²é³ö´øÓÐ50%µÄËùÓмǼ£¬Ôò»á±»ÈÏΪÊÇͨÅä·û¡£
½â¾ö£ºSelect * from tbl where name LIKE '%/%%' ESCAPE '/'
¼´a=a.Replace("%","/%%")
»òÕß[%]
3£©Ï»®Ïß_ £ºÀýÈç string a = “m_n”;
ʹÓÃlike²éѯ£¬select * from tbl where name like ‘%m_n%’,Ï»®Ïß±»ÈÏΪÊÇͨÅä·û¡£
½â¾ö£º[_]
4£©·½À¨ºÅ[]£ºÖ÷ÒªÊÇ×óÀ¨ºÅ£º[[]
5£©¼âÀ¨ºÅ^£º[^]
Ïà¹ØÎĵµ£º
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE data ......
MFCÖÐÓÃado·ÃÎÊSQL Server 2005Êý¾Ý¿â
½ñÌìÀÏ´ó½»´úÏîÄ¿£¬ÐèÒªMFC·ÃÎÊÁíһ̨»úÆ÷É쵀 SQL Server 2005Êý¾Ý¿â¡£MFCÎÒ²»Ê죬SQLÒ²´ÓûÓùý¡£ÔÚÍøÉϲéÁ˲»ÉÙ×ÊÁÏ£¬Ã¦ÁËÒ»ÕóÖÕÓÚ¸ãͨÁË¡£Óë¸÷λÅóÓÑ·ÖÏíһϣ¬¸ßÊÖÃǾͲ»Óÿ´ÁË£¬ÕâÊÇд¸øÏñÎÒÒ»Ñù³õѧÕߵġ£
Ò»¡¢°²×°SQL SERVER 2005£¬ÔÚ±¾»ú½¨Á¢·þÎñÆ÷ĬÈÏ°²×°¼´¿É£¬Ò²¿ÉÒÔ×Ô¼ ......
create proc dbo.PROC_SQL_COMP @sql1 varchar(8000),@sql2 varchar(8000),@t int
as
/*
µ÷Óãºexec dbo.PROC_SQL_COMP @sql1='',@sql2='',@t=5 & ......
OracleÓкܶàÖµµÃѧϰµÄµØ·½£¬ÕâÀïÎÒÃÇÖ÷Òª½éÉÜOracle UNION ALL£¬°üÀ¨½éÉÜUNIONµÈ·½Ã档ͨ³£Çé¿öÏ£¬ÓÃUNIONÌæ»»WHERE×Ó¾äÖеÄOR½«»áÆ𵽽ϺõÄЧ¹û¡£¶ÔË÷ÒýÁÐʹÓÃOR½«Ôì³ÉÈ«±íɨÃè¡£×¢Ò⣬ÒÔÉϹæÔòÖ»Õë¶Ô¶à¸öË÷ÒýÁÐÓÐЧ¡£¼ÙÈçÓÐcolumnûÓб»Ë÷Òý£¬²éѯЧÂÊ¿ÉÄÜ»áÒòΪÄúûÓÐÑ¡ÔñOR¶ø½µµÍ¡£ÔÚÏÂÃæµÄÀý×ÓÖУ¬LOC_ID ºÍREGION ......
-- ±íµÄ½á¹¹ area
DROP TABLE area;
CREATE TABLE area (
id int NOT NULL ,
areaID int NOT NULL,
area varchar(200) NOT NULL,
fatherID int NOT NULL,
PRIMARY KEY (id)
)
DROP TABLE city;
CREATE TABLE city select
id int NOT NULL ......