mysql

作者在 2016-04-02 15:29:00 发布以下内容

-----------------------------------

create table biao1(

stid smallint(4) zerofill primary key auto_increment,
stname varchar(20),
sex char(5),

area char(50)

)charset utf8

insert into stubase(stid,stname,sex,area) values (0001,"李小龙","男","中国香港");
insert into biao1(stid,stname,sex,area) values (0002,"周杰伦","男","中国台湾");
insert into biao1(stid,stname,sex,area) values (0003,"成龙","男","日本");
insert into biao1(stid,stname,sex,area) values (0004,”曾子丹”,”男”,”美国");
-----------------------------------------------------------------------------------
mysql -huse  localhost -p3344 -Uroot -p;
update stubase set stname ="问题男" where  stid =1;
delete from stubase where stid=2;
select * from  cc;
rename  table  stubase to cc;
alter table cc add age tinyint(6);
alter table cc drop age;

C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Python27;C:\Program Files\TortoiseSVN\bin;C:\Program Files\VisualSVN Server\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JRE_HOME%\bin;%JRE_HOME%\lib;

---------------------

1.创建student和score表
create table student(
id tinyint(10) zerofill,
name varchar(20),
sex varchar(4),
birth varchar(4),
department varchar(20),
address varchar(50))charset utf8;


create table score(
id tinyint(10) zerofill,
stu_id int(10),
c_name varchar(20),
grade varchar(10)
);charset utf8;

2.为student表和score表增加记录
向student表插入记录的INSERT语句如下:
Insert into student values(100101,'张三','男',23,'计算机系','北京市朝阳区');
Insert into student values(100102,'李四','男',21,'英语系','北京市海淀区');
Insert into student values(100103,'王五','女',19,'建工系','北京市昌平区');
Insert into student values(100104,'孙六','女',21,'化学系','北京市苏州桥');
Insert into student values(100105,'齐七','男',23,'英语系','北京市海淀区');

向score表插入记录的INSERT语句如下:
Insert into score values(001,100101,'计算机基础',89);
Insert into score values(002,100101,'英语',93);
Insert into score values(003,100101,'数学',87);
Insert into score values(004,100102,'计算机基础',83);
Insert into score values(005,100102,'英语',81);
Insert into score values(006,100102,'数学',77);
Insert into score values(007,100103,'计算机基础',91);
Insert into score values(008,100103,'英语',85);
Insert into score values(009,100103,'数学',88);
Insert into score values(010,100104,'计算机基础',84);
Insert into score values(011,100104,'英语',71);
Insert into score values(012,100104,'数学',83);



mysql | 阅读 11000 次
文章评论,共0条
游客请输入验证码
浏览2354395次