Skip to content

Instantly share code, notes, and snippets.

CREATE TABLE regions (
region_id INT NOT NULL,
region_name VARCHAR(25),
PRIMARY KEY (region_id)
);
INSERT INTO regions
VALUES (
1,
'Europe'
);
CREATE TABLE regions (
region_id INT NOT NULL,
region_name VARCHAR(25),
PRIMARY KEY (region_id)
);
INSERT INTO regions
VALUES (
1,
'Europe'
);
@civera2
civera2 / hr
Last active March 22, 2018 20:45
m
CREATE SCHEMA hr;
group: banco example
description[[ the data for this dataset was generated using <http://www.generatedata.com/>
* the relation _Customers_ contains basic information about the customers of the bank.
* the relation _Accounts_ contains the basic information of a single account. Note that a customer can have any number of accounts.
* the relation _PremiumCustomers_ contains the customer-ids of all customers with a total balance over 1000
]]
Customers = { cid firstname lastname
@civera2
civera2 / hr
Last active March 22, 2018 21:15
group: HR
description[[ the data for this dataset was generated using <http://www.generatedata.com/>
* the relation _Customers_ contains basic information about the customers of the bank.
* the relation _Accounts_ contains the basic information of a single account. Note that a customer can have any number of accounts.
* the relation _PremiumCustomers_ contains the customer-ids of all customers with a total balance over 1000
]]
CREATE TABLE regions (
region_id INT (11) NOT NULL,
group: Recursos_humanos
Dep = { Codd,Nom,Localidad
10, 'Administration', 1700
20, 'Marketing', 1800
}
group:Recursos Humanos
regions = {
region_id:number, region_name:string
1 , 'Europe'
2 , 'Americas'
3 , 'Asia'
4 , 'Middle East and Africa'
}
@civera2
civera2 / RH-Ej1
Last active April 18, 2018 11:50
group:Recursos Humanos
localidad = {
localidad_id:number, calle:string , codpostal:string, ciudad:string , provincia:string, idpais:string
1000 , '1297 Via Cola di Rie' , '00989' , 'Roma' , null , 'IT'
1100 , '93091 Calle della Testa' , '10934' , 'Venice' , null , 'IT'
1200 , '2017 Shinjuku-ku' , '1689' , 'Tokyo' , 'Tokyo Prefecture' , 'JP'
1300 , '9450 Kamiya-cho' , '6823' , 'Hiroshima' , null , 'JP'
1400 , '2014 Jabberwocky Rd' , '26192' , 'Southlake' , 'Texas' , 'US'
REM ********************************************************************
REM Create the REGIONS table to hold region information for locations
REM HR.LOCATIONS table has a foreign key to this table.
Prompt ****** Creating REGIONS table ....
CREATE TABLE regions
( region_id NUMBER
CONSTRAINT region_id_nn NOT NULL
, region_name VARCHAR2(25)
/*1.Mostrar el nombre (nombre y apellido) y el salario (salary) de todos los empleados.*/
/*π nome,ap,salario (emp)*/
/*2. Renombrar el nombre de la columna Nome a Nombre y Ap a Apellido y salario a Sueldo.*/
/*ρ Nombre←nome ,Apellido←ap, Sueldo←salario (π nome,ap,salario (emp))*/
/*3. Mostrar todos los datos de los departamentos con identificador 10 ó 70 (Codd).*/
/*σ codd=10 or codd=70 (dep)*/
/*Otra forma*/
/*σ codd=10 (dep)∪ σ codd=70 (dep)*/
/*4. Mostrar el nombre de los empleados junto al nombre del departamento donde trabajan.*/
/*π nome,ap, nom (π code, nome, ap,codd (emp) ⨝ dep)*/