cara mengatur browser ID DB yang bertambah otomatis
Create table tbl_student (
id_tbl_student integer not null primary key autoincrement,
col_student_no text not null unique,
col_name text not null,
col_sex text null,
col_status int null,
col_birthday date null,
col_id_no text null unique,
col_mobile integer UNIQUE
);
create table tbl_course (
id_tbl_course integer not null primary key autoincrement,
col_name text not null unique,
col_hours int null default 64
);
create table tbl_score (
id_tbl_score integer not null primary key autoincrement,
col_score int null check (col_score>=0 and col_score<=100),
id_tbl_course int not null references tbl_course (id_tbl_course),
id_tbl_student int not null references tbl_student (id_tbl_student),
constraint idxu_course_student unique (id_tbl_student, id_tbl_course)
);
insert into tbl_student
values ('SW103101','蔡日','F',1,'1990-5-7','372822199005076102','13987654321');
insert into tbl_student
values ('SW103102','陈琳','M',1,'1990-2-20','420922199002201021','13987654322');
insert into tbl_student
values ('SW103103','程恒坤','F',1,'1989-9-29','320283198909296002','13987654323');
insert into tbl_student
values ('SW103109','鞠迪','M',1,'1990-5-5','342623199005058001','13987654329');
insert into tbl_student
values ('NW102101','王俊峰','M',1,'1989-4-22','362424198904222008','13987654341');
insert into tbl_student
values ('NW102102','王明星','F',1,'1989-4-9','320283198904095017','13987654342');
insert into tbl_course values ('C++程序设计','80');
insert into tbl_course values ('计算机网络技术','48');
insert into tbl_course values ('数据库程序设计','64');
insert into tbl_score values (82,1,1);
insert into tbl_score values (91,1,2);
insert into tbl_score values (86,1,3);
insert into tbl_score values (90,1,4);
insert into tbl_score values (67,1,5);
insert into tbl_score values (66,2,6);
insert into tbl_score values (79,2,1);
insert into tbl_score values (94,2,2);
insert into tbl_score values (87,3,4);
insert into tbl_score values (68,3,5);
select col_name, col_mobile from tbl_student where col_sex like '%f' ;
id_tbl_student of all students whose score is greater than 80.
select id_tbl_student from tbl_score where col_score >79;
name, id_tbl_course, col_score from tbl_student and tbl_score.
select tbl_student.col_name, tbl_score.col_score, tbl_score.id_tbl_student
from tbl_score
INNER JOIN tbl_student on tbl_score.id_tbl_student=tbl_student.id_tbl_student
select tbl_student.col_name, tbl_score.col_score
from tbl_score
INNER JOIN tbl_student on tbl_score.id_tbl_course=1;