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

SQLServer¸ß¼¶±à³Ì

         ±¾ÆªÄÚÈÝϵÊôSQLServer¸ß¼¶±à³Ì£¬ÊÊÓÃÓÚÓûÌá¸ß×Ô¼ººÍ¸´Ï°»òÓ¦¸¶ÃæÊÔµÄÅóÓÑÔĶÁ£¬Í¬Ê±±¾ÈËѧϰ²»¾Ã£¬ÔÚ×ܽáºÍ¹éÄÉʱ´íÎóºÍ²»Ç¡µ±Ö®´¦ÔÚËùÄÑÃ⣬»¹ÇëÖ¸³öÆäÖБ¶ËÄß’£¬ÓèÒÔÍêÉÆ¡£
±í1:Users
USE [Wish]
GO
/****** ¶ÔÏó: Table [dbo].[Users] ½Å±¾ÈÕÆÚ: 01/29/2010 13:26:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Users](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserName] [varchar](16) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Nickname] [varchar](16) COLLATE Chinese_PRC_CI_AS NULL,
[Password] [varchar](60) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Email] [varchar](255) COLLATE Chinese_PRC_CI_AS NULL,
[Question] [varchar](40) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Answer] [varchar](40) COLLATE Chinese_PRC_CI_AS NOT NULL,
[age] [int] COLLATE ,
[ShowEmail] [bit] NOT NULL CONSTRAINT [DF_Users_ShowEmail] DEFAULT ((1)),
[Signature] [varchar](300) COLLATE Chinese_PRC_CI_AS NULL,
[ImageUrl] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_Users_ImageUrl] DEFAULT (''),
[AddedDate] [datetime] NOT NULL CONSTRAINT [DF_Users_AddedDate] DEFAULT (getdate()),
CONSTRAINT [PK_Users_UserID] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [UK_Users_UserName] UNIQUE NONCLUSTERED
(
[UserName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Ò».¸ß¼¶²éѯ
    1.¾ÛºÏº¯Êý£¨ÓÃÓÚͳ¼Æµ¥ÕűíÀïµÄÐÅÏ¢£©¡£
         .³£Óú¯Êý£ºAVG() Çóƽ¾ùÊý  COUNT() ·µ»Ø·ûºÏÌõ¼þµÄÐÐÊý  Max()  Çó×î´óÖµ  MIN() Çó×îСֵ  SUM() ÇóºÍµÈ¡£
         .¾ÙÀý˵Ã÷£¬Èç¹ûÓÐÈçÉϵÄÒ»ÕÅ±í£º
            ͳ¼ÆÓû§×ÜÈËÊý                   


Ïà¹ØÎĵµ£º

sqlserverÖÐÅúÁ¿Ð޸ĶÔÏóËùÓÐÕß

ÒÔ³¬¼¶¹ÜÀíÔ±µÇ¼ϵͳ£¬È»ºóÖ´ÐÐÒÔϽű¾¾Í¿ÉÒÔÅúÁ¿Ð޸ĶÔÏóËùÓÐÕß¡£
sp_configure 'allow updates','1'
go
reconfigure with override
go
update sysobjects set uid=1 where uid<>1
go
sp_configure 'allow updates','0'
go
reconfigure with override ......

Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ


Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ
1¡¢°ÑÖ÷¼ü¶¨ÒåΪ×Ô¶¯Ôö³¤±êʶ·ûÀàÐÍ
ÔÚmysqlÖУ¬Èç¹û°Ñ±íµÄÖ÷¼üÉèΪauto_incrementÀàÐÍ£¬Êý¾Ý¿â¾Í»á×Ô¶¯ÎªÖ÷¼ü¸³Öµ¡£ÀýÈ磺
create table customers(id int auto_increment primary key not null, name varchar(15));
insert into customers(name) values("name1"),("nam ......

mysqlºÍsqlserverÖв鿴µ±Ç°¿âÖÐËùÓбíºÍ×Ö¶ÎÐÅÏ¢

>>mysql:
1¡¢²é¿´ËùÓбíÃû£º
show tables [from db_name];
2¡¢²é¿´×Ö¶ÎÐÅÏ¢
SHOW FULL COLUMNS from db_name.table_name
»ñÈ¡ÒÔÏÂÐÅÏ¢
Field £º×Ö¶ÎÃû
Type£º×Ö¶ÎÀàÐÍ
Collation£º×Ö·û¼¯ £¨mysql 5.0ÒÔÉÏÓУ©
Null £ºÊÇ·ñ¿ÉÒÔΪNULL
Key£ºË÷Òý£¨PRI,unique,index)
Default£ºÈ±Ê¡Öµ
Extra£º¶îÍ⣨ÊÇ·ñ aut ......

SQLServerÖÐÓõıȽ϶àµÄº¯Êý

ÏÂÃæÊÇÎÒÔÚSQLServerÖÐÓõıȽ϶àµÄº¯Êý£¬Ä㻹ÓÃЩʲôº¯Êý£¿»òÕ߶ÔÄĸöº¯ÊýÓбȽϺÃÓ÷¨£¿»òÕßÄã²»ÓÃÄÄЩº¯Êý£¿
LEFT ( character_expression , integer_expression )
·µ»Ø´Ó×Ö·û´®×ó±ß¿ªÊ¼Ö¸¶¨¸öÊýµÄ×Ö·û¡£
Àý:
select left('my name is viwo',4)
my n
RIGHT ( character_expression , integer_expression )
·µ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ