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¸ö¼üÉèÖóÉÁËÁªºÏÖ÷¼ü£¬¼´Í¬Ò»¸ö¿Í»§²»¿ÉÄÜÔÚͬһʱ¼ä×âÁËͬһÕÅÓ°µú¶à´Î£©
Ïà¹ØÎĵµ£º
---ÓÃconvertת»»²ÎÊý¶Ô±È
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
20040912110608
select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12
select CONVERT(varchar(12) , getdate(), 112 )
......
ÏÂÔØµØÖ·£ºhttp://download.csdn.net/source/2384982
----------------------------------------------------------------------------
Èí¼þÃû³Æ£ºÍ¨ÓÃSql±¸·Ý»Ö¸´¹¤¾ß
Ö´ÐгÌÐò£ºiNethink_SqlTool.exe
³ÌÐò°æ±¾£ºV1.0.0.1
----------------------------------------------------------------------------
Md5Öµ:E511 ......
Ò», °²×° 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
Èç¹û°²×°ÖÐÌáʾÓÐ¶ÔÆäËü° ......
1£ºµ± SQL Óï¾äÒýÓ÷ÇË÷ÒýÊÓͼʱ£¬·ÖÎöÆ÷ºÍ²éѯÓÅ»¯Æ÷½«·ÖÎö SQL Óï¾äµÄÔ´ºÍÊÓͼµÄÔ´£¬È»ºó½«ËüÃǽâÎöΪµ¥¸öÖ´Ðмƻ®¡£Ã»Óе¥¶ÀÓÃÓÚ SQL Óï¾ä»òÊÓͼµÄ¼Æ»®¡£
2£ºË÷ÒýÊÓͼµÄÐÐÒÔ±íµÄ¸ñʽ´æ´¢ÔÚÊý¾Ý¿âÖС£Èç¹û²éѯÓÅ»¯Æ÷¾ö¶¨Ê¹Óòéѯ¼Æ»®µÄË÷ÒýÊÓͼ£¬ÔòË÷ÒýÊÓͼ½«°´ÕÕ»ù±íµÄ´¦Àí·½Ê½½øÐд¦Àí ......
¹Ì¶¨·þÎñÆ÷½ÇÉ«
sysadmin ¿ÉÒÔÔÚ SQL Server ÖÐÖ´ÐÐÈκλ¡£
serveradmin ¿ÉÒÔÉèÖ÷þÎñÆ÷·¶Î§µÄÅäÖÃÑ¡Ï¹Ø±Õ·þÎñÆ÷¡£
setupadmin ¿ÉÒÔ¹ÜÀíÁ´½Ó·þÎñÆ÷ºÍÆô¶¯¹ý³Ì¡£
securityadmin ¿ÉÒÔ¹ÜÀíµÇ¼ºÍ CREATE DATABASE ȨÏÞ£¬»¹¿ÉÒÔ¶ÁÈ¡´íÎóÈÕÖ¾ºÍ¸ü¸ÄÃÜÂë¡£
processadmin ¿ÉÒÔ¹ÜÀíÔÚ SQL Server ÖÐÔËÐеĽø³Ì¡£
......