Problema de base de datos
crear tabla stu_dent(
stu_id int identidad de clave primaria(1000, 1),
stu_xuehao int único no nulo,
stu_name varchar(10) no null,
stu_sex varchar (2) check (stu_sex='masculino' o stu_sex='female'),
stu_age int check (stu_agegt; 0 y stu_agelt; 100),
stu_ximing varchar(20) no nulo,
stu_shengao int check(stu_shengaoogt; 0 y stu_shengaolt; 200),
) --primera tabla
insertar into stu_dent value(2001,'Xiao Huang','Male', 20,'English',.152)
insert into stu_dent value(2002,'Xiao Li','M',20,' Math',152)
insertar en valores stu_dent(2003, 'Xiao Wang', 'M', 20, 'Idioma', 152)
insertar en valores stu_dent(2004, Xiao Zhang', 'M', 20, 'Física', 152 )
insertar en valores stu_dent(2005, 'Xiao Maku', 'Male', 20, 'Biología', 152)
insertar en valores stu_dent(2006, 'Zhang Fei' , 'Hombre', 20, 'Computadora', 152)
insertar en valores stu_dent( 2007, 'Xiao Fei', 'M' , 20, 'Computer', 152)
insertar en valores stu_dent(2008,'ZhangSan','Male',20,'Computer',152)--insertar datos
seleccione *de stu_dent
crear tabla stu_course(
stu_id int identidad de clave principal (1000, 1),
--stu_xh int referencias stu_dent(stu_xuehao),
stu_kh int único no nulo, -- class_number
stu_km varchar(
20), --class_name
stu_ks varchar(50) no nulo, --class hours
stu_xkh varchar(20) no nulo, --clase anterior
)--tabla clave
insertar en valores stu_course (15,'Inglés','40','Idioma')
insertar en valores stu_course (12, 'Física', '40','Matemáticas')
insertar valores del curso_estudiante (10,'Biología',
Insertar valores del curso del estudiante (4,'Idioma ','40','Física ')
Insertar valores del curso del estudiante (3, 'Computadora', '40', Inglés')--Insertar datos
Crear tabla stu_xuanke(
stu_xuh int se refiere a stu_dent(stu_xuehao) no nulo,
stu_kehao int se refiere a stu_course(stu_kh) no nulo,
stu_chegnji int no nulo,
)--la última Tabla
insertar en valores stu_xuanke(2001,15,55)
insertar en valores stu_xuanke(2001,3,55)
insertar en valores stu_xuanke (2001, 12, 99)
insertar en valores stu_xuanke (2001, 10, 66)
insertar en valores stu_xuanke (2001, 4, 44)
insertar en valores stu_xuanke(2008,15,55)
insertar en valores stu_xuanke(2008,3,55)
insertar en valores stu_xuanke(2008,12,99)
insertar en valores stu_xuanke(2008,12,99)
insertar en valores stu_xuanke xuanke(2008,10,66)
insertar en valores stu_xuanke(2008,4,44)
insertar en valores stu_xuanke(2002,15,55)
insertar en valores stu_xuanke(2006,3,100 )
insertar en valores stu_xuanke (2007, 3, 101)
insertar en valores stu_xuanke (2007, 15, 18)--Insertar datos
--/////////////// ///////////////////////////// un momento es la consulta declaración para el décimo
Tres preguntas ////////////////////////////////////////
seleccione stu_kh, stu_km de stu_ course únete a stu_xuanke en stu_kehao=stu_kh donde está stu_xuh (selecciona stu_xuh de stu_xuanke donde stu_kehao=(selecciona stu_kh de stu_course donde stu_km='computadora'))----La primera pregunta
seleccione stu_name de stu_dent donde stu_xuehao in(seleccione stu_xuh de stu_xuanke donde stu_kehao=(seleccione stu_kh de stu_course donde stu_km='English'))--La segunda pregunta
seleccione recuento(*), stu_xuh de stu_xuanke únete a stu_dent en stu_xuehao=stu_xuh donde stu_xuehao está en (selecciona stu_xuehao de stu_dent) grupo por stu_xuh con recuento(*)=5 -- La última pregunta
-- Si tienes preguntas interesantes en el futuro, recuerda para decirme, no he jugado SQL en mucho tiempo
- Última pregunta
-- Si tienes preguntas tan interesantes en el futuro, recuerda decírmelo. Tampoco he jugado SQL en mucho tiempo.
-- La última pregunta
-- Si tienes una pregunta tan interesante en el futuro, recuerda decírmelo. Hace mucho que no juego con SQL.