データベース学習-テストに必要な知識


一、SQL


1、構造化クエリー言語、関係型データベースに使用する2、大文字と小文字を区別しない

二、SQL文——表操作

1、 
create table  (
	     ,
)

create table students(
	id int unsigned primary key auto_increment,  # , 
	name varchar(10) ,
	age int unsigned,
	height decimal(5,2)  # , 5 , 2 
)
2、 
(1)drop table           # , 
(2)drop table if exists  

三、SQL文——データ操作

1、 
insert into   values(...)

(1) 
insert into students values(0,' ',20,1.75)  # , 0 default null 

(2) 
insert into students(name) values(' ')     
2、 
update   set  =  where  

update students set name=' ',age=18 where id=1
3、 
delete from   where  

delete from students where id=1
4、 
(1)select * from  
(2)select  1, 2, 3 from   where  

(3)  as
select name as  ,sex as   from students           # 
select name,sex from students s                        # 

(4)  distinct
select distinct sex from students

(5) 
>,
5、  order by
asc  
desc  
select * from students order by age asc     # 
select * from students order by age desc,studentno desc       # , 

6、 
count(*)  
max  
min  
sum  
avg  

select max(age) from students where sex=' '      # 

7、  group by
(1)select sex,count(*) from students group by sex          # 

(2)  having
select sex,count(*) from students group by sex having sex=' '            #