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

SqlÓï¾äѧϰ±Ê¼Ç(2) ´´½¨Êý¾Ý±í

use RetalDB--±íʾÔÚÊý¾Ý¿âRetalDBÖнøÐеIJÙ×÷
go
if exists (select * from sysobjects where name='tb_user')
 drop table tb_user
go
--´´½¨¿Í»§±ítb_user
create table tb_user
(
 user_id int primary key,--Ö¸¶¨ÎªÖ÷¼üʱ£¬´ËÁÐĬÈÏΪ·Ç¿Õ£¬Ö¸¶¨¹ý¶à¸öÏÞÖÆÌõ¼þʱ²»ÓÓ'”¸ô¿ª
 user_name varchar(20) not null,
 user_point int not null,
)
--´´½¨Ó°µúÀàÐͱítb_MovieType
if exists (select *from sysobjects where name='tb_movie_type')
 drop table tb_movie_type
go
create table tb_movie_type
(
 type_id int primary key,--Ö¸¶¨Ö÷¼ü
 type_name varchar(20) not null,
 type_english_name varchar(20) not null
)
--´´½¨Ó°µú±í
if exists (select * from sysobjects where name='tb_movie')
 drop table tb_movie
go
create table tb_movie
(
 movie_id int primary key,
 movie_name varchar(20) not null,
 movie_price float,
 movie_type_id int not null,
 movie_detail varchar(255)
 --Ìí¼ÓÍâ¼üÔ¼Êø
 constraint FK_movie_id foreign key(movie_type_id) references tb_movie_type(type_id)--ÒýÓÃӰƬÀàÐͱíÖеÄtype_id×Ö¶Î
)
--´´½¨×âÁÞÐÅÏ¢±í
if exists (select * from sysobjects where name='tb_retal')
 drop table tb_retal
go
create table tb_retal
(
 id int identity(1,1) primary key,--ÐÅÏ¢±àºÅ
 user_id int not null,--Íâ¼ü£¬ÒýÓÿͻ§±íÖеÄÖ÷¼üuser_id
 movie_id int not null, --Íâ¼ü£¬ÒýÓÃӰƬ±íÖеÄmovie_id 
 rent_time datetime not null  default(getdate()),--×â³öʱ¼ä£¬ÒÔ²åÈëÊý¾ÝʱµÄʱ¼äΪĬÈÏÖµ
 return_time datetime,--¹é»¹Ê±¼ä
 rent_fee float default(0)--×â½ð
 
 constraint FK_user_id foreign key(user_id) references tb_user(user_id),
 constraint FK_movie_id foreign key(movie_id) references tb_movie(movie_id)
)
´´½¨ºÃµÄ±íÈçͼËùʾ£º£¨ºóÀ´ÎªÁ˱£Ö¤tb_retalÖÐÊý¾ÝµÄΨһÐÔ£¬½«user_id,movie_id,rent_timeÕâ3¸ö¼üÉèÖóÉÁËÁªºÏÖ÷¼ü£¬¼´Í¬Ò»¸ö¿Í»§²»¿ÉÄÜÔÚͬһʱ¼ä×âÁËͬһÕÅÓ°µú¶à´Î£©


Ïà¹ØÎĵµ£º

°²×° SQL server2000ϵͳÌáʾÒÔǰµÄij¸öÎļþÒÔ¹ÒÆð

1¡¢¹ØÓÚSQL server 2000 ÔÚ°²×°¹ý³ÌÖÐÓöµ½Îļþ¹ÒÆðµÄ½â¾ö°ì·¨£º
ÔÚGhost °æ windows xp Öа²×° SQL server 2000 ʱ¾­³£»áÓöµ½°²×°³ÌÐòÔËÐе½µÚ¶þ²½£¨ÈçÏÂͼËùʾ£©Ê±µã»÷ÏÂÒ»²½ÏÔʾÓÐÎļþ¹ÒÆð²Ù×÷£¬ÌáÊ¾ÖØÐÂÆð
¶¯¼ÆËã»ú½â¾öÕâ¸öÎÊÌ⣬¿ÉÖØÐÂÆð¶¯¼ÆËã»úºó£¬°²×°³ÌÐò½øÐе½´ËÈÔÈ»ÏÔʾÓÐÎļþ¹ÒÆð²Ù×÷¡£Õâ¸öÎÊÌâµÄ²úÉúʵ¼Ê²¢ ......

JavaÃüÁîÐÐÖ´ÐдÓSQL 2000Êý¾Ý¿â×ªÒÆµ½2005Êý¾Ý¿â

1.ÏÂÔØ2005Êý¾Ý¿âÇý¶¯£¨sqljdbc.jar£©
2.ÕâʱҪÓÃEclipseµÈ¼¯³É¿ª·¢»·¾³£¬ÔÚbuild pathÀïÃæ°Ñ2000Êý¾Ý¿âÇý¶¯°üɾ³ýÁË£¬È»ºóµ¼½ø2005Êý¾Ý°ü¡£
3.°Ñ´úÂëÖÐ×¢²áÊý¾Ý¿âÇý¶¯µÄ´úÂë»»³É2005µÄ´úÂë¡£
È磺
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 2005 version
Class.forName("com.microsoft.jdb ......

sql server2005 rownumͨÓô洢¹ý³Ì·ÖÒ³

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER   PROCEDURE [dbo].[sp_GetRecordfromPage]
@TableName varchar(350),        --±íÃû
@Fields varchar(5000) = '*',    --×Ö¶ÎÃû(È«²¿×Ö¶ÎΪ*)
@OrderField varchar(5000),   &nbs ......

×ªÔØ¡°½â¾öSQL SERVER 2005ÓÃsaµÇ½ÎÊÌ⡱

×°sql 2005ºó¶ÔһЩ¹¦ÄÜ»¹²»ÊǺÜϰ¹ß£¬±ÈÈçÓÃsaµÇ¼Êý¾Ý¿âÔÚºÜ¶àµØ·½¶¼»áÓõ½£¬½ñÌì¾ÍsaµÇ¼Êý¾Ý¿âµÄһЩÐÞ¸ÄÓë´ó¼Ò·ÖÏí¡£
1.ÏÈÓÃWINDOWSģʽµÇ½,È»ºóÔÚÊý¾Ý¿â¶¥¶ËÓÒ¼üÊôÐÔ£»Èçͼ1-1£º
2.ÔÚ°²È«ÐÔϵÄWINDOWSģʽ¸ÄΪSQLÓëWINDOWSģʽ£¬ÏÂÃæµÄµÇ½ÉóºËÑ¡Ïî,Ñ¡ÔñΪ‘ÎÞ’£¬µã‘È·¶¨’£»Èçͼ1-2£º
3. ......

SqlÁ¬½Ó²éѯºÍÁªºÏ²éѯ


SqlÁ¬½Ó²éѯºÍÁªºÏ²éѯ
Á¬½Ó²éѯ
   ͨ¹ýÁ¬½ÓÔËËã·û¿ÉÒÔʵÏÖ¶à¸ö±í²éѯ¡£Á¬½ÓÊǹØÏµÊý¾Ý¿âÄ£Ð͵ÄÖ÷ÒªÌØµã£¬Ò²ÊÇËüÇø±ðÓÚÆäËüÀàÐÍÊý¾Ý¿â¹ÜÀíϵͳµÄÒ»¸ö±êÖ¾¡£
   ÔÚ¹ØÏµÊý¾Ý¿â¹ÜÀíϵͳÖУ¬±í½¨Á¢Ê±¸÷Êý¾ÝÖ®¼äµÄ¹ØÏµ²»±ØÈ·¶¨£¬³£°ÑÒ»¸öʵÌåµÄËùÓÐÐÅÏ¢´æ·ÅÔÚÒ»¸ö±íÖС£µ±¼ìË÷Êý¾Ýʱ£¬Í¨¹ýÁ¬½Ó²Ù×÷² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ