Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ejercicios de SQL (I)9
create table emple( emp_no INTEGER PRIMARY KEY, apellido VARCHAR(50) NOT NULL, oficio VARCHAR(30), dir INTEGER, fecha_alt DATE, salario INTEGER, comision INTEGER, dept_no INTEGER ); INSERT INTO emple VALUES (7369,'SÁNCHEZ', 'EMPLEADO', 7902, '1990/12/17', 1040, NULL, 20); INSERT INTO emple VALUES (7499,'ARROYO', 'VENDEDOR', 7698, '1990/02/20', 1500, 390, 30); INSERT INTO emple VALUES (7521,'SALA', 'VENDEDOR', 7698, '1991/02/22', 1625, 650, 30); INSERT INTO emple VALUES (7566,'JIMÉNEZ', 'DIRECTOR', 7839, '1991/04/02', 2900, NULL, 20); INSERT INTO emple VALUES (7654,'MARTÍN', 'VENDEDOR', 7698, '1991/09/29', 1600, 1020, 30); INSERT INTO emple VALUES (7698,'NEGRO', 'DIRECTOR', 7839, '1991/05/01', 3005, NULL, 30); INSERT INTO emple VALUES (7782,'CEREZO', 'DIRECTOR', 7839, '1991/06/09', 2885, NULL, 10); INSERT INTO emple VALUES (7788,'GIL', 'ANALISTA', 7566, '1991/11/09', 3000, NULL, 20); INSERT INTO emple VALUES (7839,'REY', 'PRESIDENTE', NULL, '1991/11/17', 4100, NULL, 10); INSERT INTO emple VALUES (7844,'TOVAR', 'VENDEDOR', 7698, '1991/09/08', 1350, 0, 30); INSERT INTO emple VALUES (7876,'ALONSO', 'EMPLEADO', 7788, '1991/09/23', 1430, NULL, 20); INSERT INTO emple VALUES (7900,'JIMENO', 'EMPLEADO', 7698, '1991/12/03', 1335, NULL, 30); INSERT INTO emple VALUES (7902,'FERNÁNDEZ','ANALISTA', 7566, '1991/12/03', 3000, NULL, 20); INSERT INTO emple VALUES (7934,'MUÑOZ', 'EMPLEADO', 7782, '1992/01/23', 1690, NULL, 10); create table depart( dept_no INTEGER, dnombre VARCHAR(30), loc VARCHAR(30) ); INSERT INTO depart VALUES (10, 'CONTABILIDAD', 'SEVILLA'); INSERT INTO depart VALUES (20, 'INVESTIGACIÓN', 'MADRID'); INSERT INTO depart VALUES (30, 'VENTAS', 'BARCELONA'); INSERT INTO depart VALUES (40, 'PRODUCCIÓN', 'BILBAO'); --SELECT * FROM emple --SELECT apellido, oficio, dept_no FROM emple --SELECT dept_no, dnombre, loc FROM depart --SELECT * FROM emple --SELECT * FROM emple ORDER BY apellido --SELECT apellido, oficio, dept_no FROM emple ORDER BY dept_no DESC --SELECT apellido, oficio, dept_no FROM emple ORDER BY dept_no DESC, apellido ASC SELECT dnombre , apellido FROM depart inner join emple on depart.dept_no = emple.dept_no ORDER BY dnombre desc, apellido asc
run
|
edit
|
history
|
help
0
Movies
StackOverflow_53753663
Microsoft SQL Server T-SQL in 10 mn ~ Lesson 13 Subqueries vers. #5
prince46
Outer Apply successer cell chek and get the result
mc170400712
shrink logs
Status History
Cinema latinoamericano
SinghDestiny