insert into products(prod_id,prod_name,pro_price)values('avno1','.5 ton anvil',5.99); |
深入理解: select * from student; ------------------------------------------select t.sid+1 'tsid加了1', t.sid+5, t.score+100, t.sid+t.score as 'sid_score', t.*, 5*8 '五' from student t; ------------------------------------------ select t.sid, t.sname, -- 设置别名 from student t; ------------------------------------------ select t.sid, t.sname, -- 常量列 5, from student t; ------------------------------------------ select -- sid列数据加一,并创建一个t.sid+1列的数据 t.sid +1, t.sname, t* from student t; ------------------------------------------ select -- 两个整型数据相加,得出t.score+t.ccid列名的相加数据 t.score+t.ccid from student t; ------------------------------------------ select -- 'ni'列名 t.score 'ni', -- 'why'列名 t.ccid 'why', -- 'you'列名 t.score+t.ccid 'you' from student t; ------------------------------------------ select -- 整型和字符类型数据相加,得出t.score+t.sname列名的t.score数据(字符类型和整型数据相加,结果也是一样,以整型为主) t.score+t.sname from student t; ------------------------------------------ select -- 改为'我'列名 t.score '我' from student t; ------------------------------------------ select -- '加'列名 t.score '加', -- ‘王’列名 5 ‘王’ from student t; ------------------------------------------ select -- '加'列名 t.score '加', 5 from student t -- 常数列名不能相加(还是‘加’列名数据,5列名数据) where t.score +5; ------------------------------------------ select s.score+5 'q',s.score+s.ccid,5 '我' from student s; ------------------------------------------ select -- '加'列名 t.ccid '加', -- 常数列名 5 , -- t.ccid+5列名相加的数据 ------------------------------------------ -- select * from student t where t.score>70 order by t.score desc limit 5; select * from student t ------------------------------------------ ------------------------------------------ select * from student;------------------------------------------ create table student (id int not null auto_increment, primary key(id) )engine = innodb; ------------------------------------------ alter table student add sname char(40); alter table student add score int; alter table student add ccid int; ------------------------------------------ insert into student(sname,score,ccid) values('wpq2',93,1); insert into student(sname,score,ccid) values('wpq3',45,1);insert into student(sname,score,ccid) values('QQ5',43,1); insert into student(sname,score,ccid) values('wp9',60,1); insert into student(sname,score,ccid) values('w',99,1); insert into student(sname,score,ccid) values('w123',91,1); |