Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 ʱ¾­³£»áÓöµ½°²×°³ÌÐòÔËÐе½µÚ¶þ²½£¨ÈçÏÂͼËùʾ£©Ê±µã»÷ÏÂÒ»²½ÏÔʾÓÐÎļþ¹ÒÆð²Ù×÷£¬ÌáÊ¾ÖØÐÂÆð
¶¯¼ÆËã»ú½â¾öÕâ¸öÎÊÌ⣬¿ÉÖØÐÂÆð¶¯¼ÆËã»úºó£¬°²×°³ÌÐò½øÐе½´ËÈÔÈ»ÏÔʾÓÐÎļþ¹ÒÆð²Ù×÷¡£Õâ¸öÎÊÌâµÄ²úÉúʵ¼Ê²¢ ......

hqlÓësqlµÄÇø±ð


     1.hqlÓësqlµÄÇø±ð
sql ÃæÏòÊý¾Ý¿â±í²éѯ
hql ÃæÏò¶ÔÏó²éѯ
hql £º from ºóÃæ¸úµÄ ÀàÃû£«Àà¶ÔÏó where ºó Óà ¶ÔÏóµÄÊôÐÔ×öÌõ¼þ
sql£º from ºóÃæ¸úµÄÊDZíÃû             where ºó ÓñíÖÐ×Ö¶Î×öÌõ¼þ
 
 
 
²éѯ
  &nbs ......

ÔÚlinuxÉÏÅäÖÃunixODBCºÍFreeTDS·ÃÎÊMS SQL Server.

Ò», °²×° unixODBC
ÏÂÔØ°²×°°ü. ÔÚ RedHat °²×°¹âÅÌÉϾÍÓÐ
unixODBC-2.2.11-1.RHEL4.1.i386.rpm
unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
unixODBC-kde-2.2.11-1.RHEL4.1.i386.rpm
°²×°
rpm -Uvh unixODBC-2.2.11-1.RHEL4.1.i386.rpm
rpm -Uvh unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
Èç¹û°²×°ÖÐÌáʾÓÐ¶ÔÆäËü° ......

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. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ