²»´íµÄSQLÃæÊÔÌ⣨¶þ£©
ÎÊÌâÃèÊö£º
±¾ÌâÓõ½ÏÂÃæÈý¸ö¹Øϵ±í£º
CARD ½èÊ鿨¡£ CNO ¿¨ºÅ£¬NAME ÐÕÃû£¬CLASS °à¼¶
BOOKS ͼÊé¡£ BNO ÊéºÅ£¬BNAME ÊéÃû,AUTHOR ×÷Õߣ¬PRICE µ¥¼Û£¬QUANTITY ¿â´æ²áÊý
BORROW ½èÊé¼Ç¼¡£ CNO ½èÊ鿨ºÅ£¬BNO ÊéºÅ£¬RDATE »¹ÊéÈÕÆÚ
±¸×¢£ºÏÞ¶¨Ã¿ÈËÿÖÖÊéÖ»ÄܽèÒ»±¾£»¿â´æ²áÊýËæ½èÊé¡¢»¹Êé¶ø¸Ä±ä¡£
ÒªÇóʵÏÖÈçÏÂ15¸ö´¦Àí£º
1£® д³ö½¨Á¢BORROW±íµÄSQLÓï¾ä£¬ÒªÇó¶¨ÒåÖ÷ÂëÍêÕûÐÔÔ¼ÊøºÍÒýÓÃÍêÕûÐÔÔ¼Êø¡£
2£® ÕÒ³ö½èÊ鳬¹ý5±¾µÄ¶ÁÕß,Êä³ö½èÊ鿨ºÅ¼°Ëù½èͼÊé²áÊý¡£
3£® ²éѯ½èÔÄÁË"Ë®ä°"Ò»ÊéµÄ¶ÁÕߣ¬Êä³öÐÕÃû¼°°à¼¶¡£
4£® ²éѯ¹ýÆÚδ»¹Í¼Ê飬Êä³ö½èÔÄÕߣ¨¿¨ºÅ£©¡¢ÊéºÅ¼°»¹ÊéÈÕÆÚ¡£
5£® ²éѯÊéÃû°üÀ¨"ÍøÂç"¹Ø¼ü´ÊµÄͼÊ飬Êä³öÊéºÅ¡¢ÊéÃû¡¢×÷Õß¡£
6£® ²éѯÏÖÓÐͼÊéÖм۸ñ×î¸ßµÄͼÊ飬Êä³öÊéÃû¼°×÷Õß¡£
7£® ²éѯµ±Ç°½èÁË"¼ÆËã·½·¨"µ«Ã»Óнè"¼ÆËã·½·¨Ï°Ì⼯"µÄ¶ÁÕߣ¬Êä³öÆä½èÊ鿨ºÅ£¬²¢°´¿¨ºÅ½µÐòÅÅÐòÊä³ö¡£
8£® ½«"C01"°àͬѧËù½èͼÊéµÄ»¹ÆÚ¶¼ÑÓ³¤Ò»ÖÜ¡£
9£® ´ÓBOOKS±íÖÐɾ³ýµ±Ç°ÎÞÈ˽èÔĵÄͼÊé¼Ç¼¡£
10£®Èç¹û¾³£°´ÊéÃû²éѯͼÊéÐÅÏ¢£¬Ç뽨Á¢ºÏÊʵÄË÷Òý¡£
11£®ÔÚBORROW±íÉϽ¨Á¢Ò»¸ö´¥·¢Æ÷£¬Íê³ÉÈçϹ¦ÄÜ£ºÈç¹û¶ÁÕß½èÔĵÄÊéÃûÊÇ"Êý¾Ý¿â¼¼Êõ¼°Ó¦ÓÃ"£¬¾Í½«¸Ã¶ÁÕߵĽèÔļǼ±£´æÔÚBORROW_SAVE±íÖУ¨×¢ORROW_SAVE±í½á¹¹Í¬BORROW±í£©¡£
12£®½¨Á¢Ò»¸öÊÓͼ£¬ÏÔʾ"Á¦01"°àѧÉúµÄ½èÊéÐÅÏ¢£¨Ö»ÒªÇóÏÔʾÐÕÃûºÍÊéÃû£©¡£
13£®²éѯµ±Ç°Í¬Ê±½èÓÐ"¼ÆËã·½·¨"ºÍ"×éºÏÊýѧ"Á½±¾ÊéµÄ¶ÁÕߣ¬Êä³öÆä½èÊ鿨ºÅ£¬²¢°´¿¨ºÅÉýÐòÅÅÐòÊä³ö¡£
14£®¼Ù¶¨ÔÚ½¨BOOKS±íʱûÓж¨ÒåÖ÷Â룬д³öΪBOOKS±í×·¼Ó¶¨ÒåÖ÷ÂëµÄÓï¾ä¡£
15£®¶ÔCARD±í×öÈçÏÂÐ޸ģº
a. ½«NAME×î´óÁпíÔö¼Óµ½10¸ö×Ö·û£¨¼Ù¶¨ÔΪ6¸ö×Ö·û£©¡£
b. Ϊ¸Ã±íÔö¼Ó1ÁÐNAME£¨ÏµÃû£©£¬¿É±ä³¤£¬×î´ó20¸ö×Ö·û¡£
1. д³ö½¨Á¢BORROW±íµÄSQLÓï¾ä£¬ÒªÇó¶¨ÒåÖ÷ÂëÍêÕûÐÔÔ¼ÊøºÍÒýÓÃÍêÕûÐÔÔ¼Êø
--ʵÏÖ´úÂ룺
CREATE TABLE BORROW(
CNO int FOREIGN KEY REFERENCES CARD(CNO),
BNO int FOREIGN KEY REFERENCES BOOKS(BNO),
RDATE datetime,
PRIMARY KEY(CNO,BNO))
2. ÕÒ³ö½èÊ鳬¹ý5±
Ïà¹ØÎĵµ£º
SQL°æ£º
alter proc testguo
(
@cityid int,
@cityname nvarchar(100) output
)
as
select @cityname = city_name from BA_Hot_City where cityid = @cityid
select @cityname
go
declare @cityname nvarchar(100)
exec testguo 1,@cityname output
ÁíÒ»°æ£º
ht ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......
@SuppressWarnings("unchecked")
public List<ZxFunction> selectFunctionParentByUserId(final int userId) {
try {
final String sql = "select * from zx_function ......
ÍøÂç±ðÃû
-----------------------------------------------------------------------------
ÓÃ;£ºÎªÔ¶³Ì·þÎñÆ÷µÄÒÑÓбíÌí¼ÓÊý¾Ý
-----------------------------------------------------------------------------
²½Ö裺
SQL Server2000/2005
1. ÔËÐпͻ§¶ËÍøÂçʵÓù¤¾ß£¨
£¨1£© SQL Server2000-Client Network Ut ......