È«¹úËùÓгÇÊÐSQL
--Ê¡¼¶ Provincial
--³ÇÊÐ City
create table Provincial(pid int,Provincial varchar(50),primary key (pid))
insert into Provincial values(1,'±±¾©ÊÐ')
insert into Provincial values(2,'Ìì½òÊÐ')
insert into Provincial values(3,'ÉϺ£ÊÐ')
insert into Provincial values(4,'ÖØÇìÊÐ')
insert into Provincial values(5,'ºÓ±±Ê¡')
insert into Provincial values(6,'ɽÎ÷Ê¡')
insert into Provincial values(7,'̨ÍåÊ¡')
insert into Provincial values(8,'ÁÉÄþÊ¡')
insert into Provincial values(9,'¼ªÁÖÊ¡')
insert into Provincial values(10,'ºÚÁú½Ê¡')
insert into Provincial values(11,'½ËÕÊ¡')
insert into Provincial values(12,'Õã½Ê¡')
insert into Provincial values(13,'°²»ÕÊ¡')
insert into Provincial values(14,'¸£½¨Ê¡')
insert into Provincial values(15,'½Î÷Ê¡')
insert into Provincial values(16,'ɽ¶«Ê¡')
insert into Provincial values(17,'ºÓÄÏÊ¡')
insert into Provincial values(18,'ºþ±±Ê¡')
insert into Provincial values(19,'ºþÄÏÊ¡')
insert into Provincial values(20,'¹ã¶«Ê¡')
insert into Provincial values(21,'¸ÊËàÊ¡')
insert into Provincial values(22,'ËÄ´¨Ê¡')
insert into Provincial values(23,'¹óÖÝÊ¡')
insert into Provincial values(24,'º£ÄÏÊ¡')
insert into Provincial values(25,'ÔÆÄÏÊ¡')
insert into Provincial values(26,'Çຣʡ')
insert into Provincial values(27,'ÉÂÎ÷Ê¡')
insert into Provincial values(28,'¹ãÎ÷׳×å×ÔÖÎÇø')
insert into Provincial values(29,'Î÷²Ø×ÔÖÎÇø')
insert into Provincial values(30,'ÄþÏÄ»Ø×å×ÔÖÎÇø')
insert into Provincial values(31,'н®Î¬Îá¶û×ÔÖÎÇø')
insert into Provincial values(32,'ÄÚÃɹÅ×ÔÖÎÇø')
insert into Provincial values(33,'°ÄÃÅÌرðÐÐÕþÇø')
insert into Provincial values(34,'Ïã¸ÛÌرðÐÐÕþÇø')
--select pid,Provincial from Provincial
create table City(cid int not null,city varchar(50) primary key,pid int foreign key references Provincial(pid))
----------------------------------------------------------------------------------------------------------------------------------------
-----------------------------
Ïà¹ØÎĵµ£º
CREATE FUNCTION dbo.UF_GetInvoiceSerials( @bizCode VARCHAR(10))
RETURNS VARCHAR(100)
AS
BEGIN
DECLARE @ret AS VARCHAR(1000)
SELECT @ret=Coalesce(@ret + ', ','') +
CASE e.ID
  ......
·½°¸1 ÊÊÓÃÓÚoracle9iÒÔÉÏ£¡
select * from
(select row_number() over(order by sendid desc) rn,m.* from xxt_msgreceive m )
where rn <1010 and rn>=1000
·½°¸2
SELECT * from (SELECT A.*, ROWNUM RN from (SELECT * from xxt_msg where sendstatus=1 order by msgid desc) A WHERE ROWNUM < ......
½ñÌìдÍøÕ¾µÄʱºòºÜ囧°¡£¬·¢ÏÖ²éÕÒÓû§È¨ÏÞµÄʱºòÎÞÔµÎ޹ʵÄͬһ¸öȨÏÞÖظ´³öÏֺܶà´Î
Ð޸ĺóµÄSQLÓï¾äÈçÏÂ
SELECT
node
.
id
,
node
.
name
,
access
.
role_id
from
think_role_user
AS
user
,
think_access
AS
access
,
think_node
AS
node
WHERE
user
.
user_id
=
......
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄsql serverÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý£¨clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý£©ºÍ·Ç¾Û¼¯Ë÷Òý£¨nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý£©¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï× ......