数据的操作(增删改查)
1.插入数据:
(1)单行INSERT语句
INSERT INTO [表名] (字段1,字段2) VALUES (100,'51WINDOWS.NET')
(2)多行INSERT语句
INSERT INTO [表名] (字段1,字段2) SELECT (字段1,字段2) FROM [表名2] WHERE [条件]
2.删除数据:
DELETE FROM [表名] WHERE [字段名]>100
更新数据:
UPDATE [表名] SET [字段1] = 200,[字段2] = '51WINDOWS.NET' WHERE [字段三] =
\'HAIWA\'
3.查询数据:
select (字段1,字段2) from [表名] where [条件] order by [字段] desc;
4.删除表:
Drop table [表名]
5.新增字段:
ALTER TABLE [表名] ADD [字段名] NVARCHAR (50) NULL
6.删除字段:
ALTER TABLE [表名] DROP COLUMN [字段名]
7.修改字段:
ALTER TABLE [表名] ALTER COLUMN [字段名] NVARCHAR (50) NULL
1.插入数据:
(1)单行INSERT语句
INSERT INTO [表名] (字段1,字段2) VALUES (100,'51WINDOWS.NET')
(2)多行INSERT语句
INSERT INTO [表名] (字段1,字段2) SELECT (字段1,字段2) FROM [表名2] WHERE [条件]
2.删除数据:
DELETE FROM [表名] WHERE [字段名]>100
更新数据:
UPDATE [表名] SET [字段1] = 200,[字段2] = '51WINDOWS.NET' WHERE [字段三] =
\'HAIWA\'
3.查询数据:
select (字段1,字段2) from [表名] where [条件] order by [字段] desc;
4.删除表:
Drop table [表名]
5.新增字段:
ALTER TABLE [表名] ADD [字段名] NVARCHAR (50) NULL
6.删除字段:
ALTER TABLE [表名] DROP COLUMN [字段名]
7.修改字段:
ALTER TABLE [表名] ALTER COLUMN [字段名] NVARCHAR (50) NULL