mysql帮助文档学习
select * from t1, t2 where t1.id = t2.id;mysql -h host -u user -p
quit
select version(), current_date;
select sin(pi()/4), (4+1)/5;
select version();
select now();
select user(), current_date;
\c(取消前面输入的)
select * from my_table where name = 'Smith' and age < 30;
show databases;
use test(use 和quit不用分号)
grant all on menagerie .* to 'your_mysql_name'@'your_client_host'; (不解)
create datebase menagerie;
use menagerie
mysql -h host -u user -p menagerie
show tables;
create table pet (name varchar(20), owner varchar(20),
species varchar(20), sex char(1), birth date, death date);
show tables;
describe pet;
load data local infile '/path/pet.txt' into table pet;
insert into pet values ('puff', 'Diane','hamster','f','1990-12-11',NULL);
select what from table where conditions;
select * from pet;
delete from pet;
load data local infile 'pet.txt' into table pet;
update pet set birth = '1998-12-11' where name = 'Bowser';
select * from pet where species = 'snake' or species = 'bird';
select * from pet where (species = 'cat' and sex = 'm') or (species = 'dog' and sex = 'f');
select name, birth from pet;
select distinct owner from pet;
select name, species, birth from pet where species ='dog' or species = 'cat';
select name from pet order by birth desc;
select name, species, birth from pet order by species, birth desc;(desc只影响birth,不影响species)
select name, curdate(),(year(curdate())-year(birth))-(right(curdate(),5)
页:
[1]