//查看mysql版本
select version();
//查看日期
select date();
//查看时间
select time();
//添加主键
alter table ta add primary key(id);
//将文本中的数据导入MYSQL数据库
load data local infile "E:/a.txt" into table tt;
//将数据导出到文本
select * from tt into outfile "E:/cc.txt";
//多表查询
select tt.name,ta.pp,ta.yy from tt,ta where ta.id=tt.id and tt.name='aa';
//表里面增加一列"sex"
alert table ta add column sex char(1);
//显示服务器运行状态
show status;
//创建索引
create index aa on tt(name);
//在另一个表中得到查询条件
select * from score where event_id in (select event_id from event where type='T');
select version();
//查看日期
select date();
//查看时间
select time();
//添加主键
alter table ta add primary key(id);
//将文本中的数据导入MYSQL数据库
load data local infile "E:/a.txt" into table tt;
//将数据导出到文本
select * from tt into outfile "E:/cc.txt";
//多表查询
select tt.name,ta.pp,ta.yy from tt,ta where ta.id=tt.id and tt.name='aa';
//表里面增加一列"sex"
alert table ta add column sex char(1);
//显示服务器运行状态
show status;
//创建索引
create index aa on tt(name);
//在另一个表中得到查询条件
select * from score where event_id in (select event_id from event where type='T');
数据库操作与数据导入导出技术详解
本文详细介绍了MySQL数据库的基本操作,包括查看版本、日期、时间,添加主键,进行文本数据导入与导出,多表查询,以及在表中增加列和创建索引等关键步骤。

被折叠的 条评论
为什么被折叠?



