sql 语句总结
mysql : 将一个表的数据插入到newT 中
(newT 表须存在,且结构与select 语句对应的结构同 ,最好不用* 而是具体字段)
insert into newT select * from t1 where ...
也可以create table newT select f1,f2 from t1; (select into 的替代方法,mysql 不支持select into )
MySQL不支持Select Into
database table 的备份
mysqldump -uroot -proot -h192.101.111.111 databaseName [tableName] >a.sql
生成表结构及里面的所有数据
================================
可以用下列语句
source a.sql 重新导入
当然导入之前可以修改a.sql 里的内容,如表名,如此可实现备份
将数据备份,(不是导出sql 语句,而只导出 其中 的数据)
select * into outfile 'c:\out.txt' from tableName where ...;
对应的导入:
load data local infile 'c:\out.txt' into table positiondata fileds terminated by ';' (userid ,username );
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
SqlCommand com = new SqlCommand("select * from myuser where username=@UserName and password=@Pwd", con);
com.Parameters.Add(new SqlParameter("@UserN ......
先来一段代码:
WITH OrderedOrders AS
(SELECT *,
ROW_NUMBER() OVER (order by [id])as RowNumber --id是用来排序的列
from table_info ) --table_info是表名
SELECT *
from OrderedOrders
WHERE RowNumber between 50 and 60;
在windows server 2003, sql server 2005 CTP,P4 2.66GHZ,1GB 内存下测试,执行时 ......
declare @ID varchar(10)
set @ID=9 --根节点
declare @i int --级数
declare @t table(ID varchar(10),ParentID varchar(10),Level int)
set @i = 1
insert into @t select @ID,0,0 --当前级,本级,如果不要的话可以注释掉或再加个参数来选择操作
insert into @t select ID,ParentID,@i from t_ ......