SlideShare uma empresa Scribd logo
1 de 18
-----------------------------------------------------------
-- SQL ejercicio 1
-----------------------------------------------------------

-----------------------
-- Tabla Branch
-----------------------
CREATE TABLE Branch
(
  branch_id      int NOT NULL,
  name_br        varchar(20) NOT NULL ,
  adress_br     varchar(30) NULL ,
  city_br    varchar(20) NULL ,
  state_br      varchar(2) NULL ,
  zip_br varchar(12) NULL,

);

-----------------------
-- tabla employee
-----------------------
CREATE TABLE employee
(
  emp_id        int NOT NULL,
  fname_emp       varchar(20) NOT NULL ,
  lname_emp       varchar (20) NOT NULL,
  "start_date"     date NOT NULL ,
  end_date date NOT NULL,
  dept_id      int NOT NULL,
  title        varchar(20) NULL,

);
-----------------------

-----------------------
-- tabla departamento
-----------------------
CREATE TABLE Department
(
   dept_id       int NOT NULL ,
   name_dept varchar(20) NOT NULL ,
);
-----------------------
-----------------------
-- tabla producto
-----------------------
CREATE TABLE Product
(
   product_cd     varchar(10) NOT NULL,
   name_prod      varchar(50) NOT NULL ,
   date_offered date NULL ,
   date_retired date NULL,
);
-----------------------

-----------------------
-- tabla tipo de producto
-----------------------
CREATE TABLE Product_Type
(
   product_type_cd   varchar(10) NOT NULL,
   name_prod         varchar(50) NOT NULL ,
);
-----------------------

-----------------------
-- tabla cuenta
-----------------------
CREATE TABLE account
(
  account_id     int NOT NULL ,
  product_cd varchar(10) NULL,
  cust_id int NOT NULL,
  open_date date NULL,
  close_date date NULL,
  last_activity_date date NULL,
  status_acc varchar(10) NULL,
  avan_balance float(10) NULL,
  open_brach_id int NOT NULL

);
-----------------------

-----------------------
-- tabla transaciones
-----------------------
CREATE TABLE "transaction"
(
  txn_id int NOT NULL,
  txn_date     datetime NOT NULL ,
   account_id int NOT NULL,
  txn_type_cd   varchar(10) NULL ,
  amount       decimal(10,2) NOT NULL,
  funds_avail_date datetime NULL,

);
-----------------------

-----------------------
-- tabla Clientes
-----------------------
CREATE TABLE customer
(
  cust_id int NOT NULL,
  fed_id varchar (12) NOT NULL,
  cust_type_cd    varchar (2) NOT NULL ,
  adress_cust varchar(30) NULL ,
  city_cust varchar(20) NULl,
  "state_cust" varchar(20) NULL,
  postal_code_cust varchar(20) NULL

);
-----------------------
-----------------------
-- tabla Clientes empresarios
-----------------------
CREATE TABLE business
(
  cust_id int NOT NULL,
  name_business    varchar (40) NULL ,
  state_id   varchar(10) NULL ,
  incorp_date date NULL,

);
-----------------------
-----------------------
-- Tabla de Clientes Oficinas
-----------------------
CREATE TABLE officer
(
   officer_id int NOT NULL,
   cust_id   int NOT NULL,
   fname    varchar (30) NULL ,
   lname    varchar (30) NULL ,
   title    varchar (20) NULL,
   "start_date" date NULL,
   end_date date null,

);
-----------------------

-----------------------
-- Tabla de Clientes Individuales
-----------------------
CREATE TABLE individual
(
  cust_id int NOT NULL,
  fname    varchar (30) NULL ,
  lname    varchar (30) NULL ,
  birth_date date NULL,
   );
-----------------------
----------------------
-- Define primary keys
----------------------
ALTER TABLE Branch WITH NOCHECK ADD CONSTRAINT PK_Branch PRIMARY KEY
CLUSTERED (Branch_id);
ALTER TABLE Employee WITH NOCHECK ADD CONSTRAINT PK_employee PRIMARY KEY
CLUSTERED (emp_id);
ALTER TABLE product WITH NOCHECK ADD CONSTRAINT PK_productc PRIMARY KEY
CLUSTERED (product_cd);
ALTER TABLE Product_Type_cd WITH NOCHECK ADD CONSTRAINT PK_Product_Type
PRIMARY KEY CLUSTERED (product_cd);
ALTER TABLE Department WITH NOCHECK ADD CONSTRAINT PK_Department PRIMARY
KEY CLUSTERED (dept_id);
ALTER TABLE account WITH NOCHECK ADD CONSTRAINT PK_account PRIMARY KEY
CLUSTERED (account_id);
ALTER TABLE "transaction" WITH NOCHECK ADD CONSTRAINT PK_trasaction
PRIMARY KEY CLUSTERED ( txn_id);
ALTER TABLE customer WITH NOCHECK ADD CONSTRAINT PK_customer PRIMARY KEY
CLUSTERED ( cust_id);
ALTER TABLE individual WITH NOCHECK ADD CONSTRAINT PK_individual PRIMARY
KEY CLUSTERED ( cust_id);
ALTER TABLE business WITH NOCHECK ADD CONSTRAINT PK_business PRIMARY KEY
CLUSTERED ( cust_id);
ALTER TABLE officer WITH NOCHECK ADD CONSTRAINT PK_officer PRIMARY KEY
CLUSTERED ( officer_id);


----------------------
-- Define foreign keys
----------------------
ALTER TABLE Product ADD
CONSTRAINT FK_product_type_cd FOREIGN KEY (product_cd) REFERENCES product
(product_cd);
ALTER TABLE account ADD
CONSTRAINT FK_product_cd FOREIGN KEY (product_cd) REFERENCES
product(product_cd),
CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id),
CONSTRAINT FK_open_branch_id FOREIGN KEY (branch_id) REFERENCES
branch(branch_id),
CONSTRAINT FK_open_emp_id FOREIGN KEY (emp_id) REFERENCES
employee(emp_id);
ALTER TABLE officer ADD
CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES bussiness
(cust_id);
ALTER TABLE business ADD
CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id);
ALTER TABLE individual ADD
CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id);
ALTER TABLE employee ADD
CONSTRAINT FK_dept_id FOREIGN KEY (dept_id) REFERENCES
departament(dept_id),
CONSTRAINT FK_assined_branch_id FOREIGN KEY (branch_id) REFERENCES
branch(branch_id),
CONSTRAINT FK_superior_emp_id FOREIGN KEY (emp_id) REFERENCES
employee(emp_id);
ALTER TABLE "transaction" ADD
CONSTRAINT FK_execution_branch_id FOREIGN KEY (brach_id) REFERENCES
branch (branch_id),
CONSTRAINT FK_emp_id FOREIGN KEY (emp_id) REFERENCES employee (emp_id),
CONSTRAINT FK_account_id FOREIGN KEY (account_id) REFERENCES account
(account_id);
--------------------------------
---registro de sucursal
--------------------------------


INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,
zip_br)
VALUES('1000000001', 'The angeles', '200 Agust Flor', 'Angeles', 'AP',
'44444');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000002', 'Las americas', '300 Americo Vespucio', 'Veracruz',
'MX', '92464');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000003', 'J Paulling Salazar', '45 vistamar ', 'Veracruz',
'VR', '12444');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000004', 'Sunday', '566-A España ', 'Distrito Federal', 'MX',
'52464');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000005', 'Altamirano', '567 Dictamen ', 'Guadalajara', 'GA',
'33346');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000006', 'Espino Suarez', '744 Buena Vista ', 'Oaxaca', 'OX',
'84646');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000007', 'Serfin', '352 Bella vista ', 'Buenos Aires', 'BA',
'454543');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000008', 'Banserfi', '564 Isidro ', 'Santiago', 'TM',
'454542');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000009', 'American ', '564 Familia ', 'Nuevo leon', 'MY',
'454542');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000010', 'Santa Maria', '4543 Elena Olivares ', 'Tampico',
'VZ', '454542');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000011', 'The cid', '5453 Puesta del sol ', 'Veracruz', 'vz',
'454542');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000012', 'Zachizone', '553 Amaranto ', 'Zachila', 'OX',
'454542');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000013', 'Primero de mayo', '5434 Centro ', 'Veracruz', 'VZ',
'5945322');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000014', '20 de noviembre', '365 20 de noviembre ',
'Veracruz', 'VZ', '5945442');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000015', 'Milan', '365 20 de noviembre ', 'Veracruz', 'VZ',
'5945442');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000016', 'felicidad', '34 20 de noviembre ', 'Veracruz',
'VZ', '5945436');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000017', 'Astillero', '8676 Mateo', 'cordoba', 'VZ',
'5945442');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000018', 'Villa', '64 Villa Pequeña', 'Xalapa', 'VZ',
'1944442');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000019', 'Los pinos', '644 Los pinos', 'Perote', 'VZ',
'295442');
INSERT INTO Branch(branch_id, name_br, adress_br, city_br,
state_br,zip_br)
VALUES('1000000020', 'Santiago', '44 Gutierrez Morales', 'Nuevo Leon',
'MY', '655442');

--------------------------------
---registro de productos
--------------------------------
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('BON01', 'Papel Bond Sol', '2010-02-02', '2010-03-06');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('LAG01', 'Lapiz Grafito Print ', '2010-01-31', '2010-02-22');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('FOCB1', 'Fomi carta brillante ', '2010-01-31', '2010-02-22');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('SSTI1', 'Sony Tinta Impresora ', '2010-02-05', '2010-02-26');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('DDL01', 'Durometro de lapiz ', '2010-02-06', '2010-03-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('VMC01', 'Volantes media carta ', '2010-02-06', '2010-03-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('GEC42', 'Grapas estandar alterk plus ', '2010-01-06', '2010-03-
01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('IMA01', 'Imanes ok impresos', '2010-03-06', '2010-04-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('MART1', 'Marcatextos', '2010-03-06', '2010-04-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('POFV1', 'Postales A color', '2010-04-06', '2010-05-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('CLIP1', 'Clip alterkl plus', '2010-02-06', '2010-05-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('FTC01', 'Folder Carta Alterkl plus', '2010-02-06', '2010-05-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('MTB02', 'Marca texto borrable', '2010-02-10', '2010-05-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('MBF01', 'Marcador para billetes falsos Check it azoe', '2010-02-
10', '2010-05-01');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('HC001', 'Hojas color millar', '2011-01-01', '2011-01-31');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('FCC01', 'archivador', '2011-01-03', '2011-09-31');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('EM001', 'equipo multifuncion', '2010-01-03', '2011-01-31');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('DP002', 'destructora de papel', '2010-01-01', '2011-01-31');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('RF001', 'Regla flexible Shelly', '2011-02-03', '2011-01-31');
INSERT INTO Product(product_cd, name_prod, date_offered, date_retired)
VALUES('CCP01', 'Chinche Color 100 Piezas', '2011-02-03', '2011-01-31');



--------------------------------
---registro de tipos de productos
--------------------------------
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EQ01', 'Computadora de escritorio HP');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EQ02', 'Laptop Toshiba Satellite');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('CI01', 'Copia BYN 80%');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('CI02', 'Copia BYN 100%');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('PU01', 'Poster C. 50x50');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('AA01', 'Lapiz Grafito para dibujar Big');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('DG01', 'Edicion Imagen N1');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('UE01', 'Lapiz n°2 Milano ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('DG02', 'Edicion Imagen N2 ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('AA02', 'Hojas de dibujo Cari ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('AA03', 'Paleta para pintar SER');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EO01', 'Escritorio estandar oficina Bell ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EO02', 'Maquina de escribir Olympia ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EO03', 'Trituradora de papel Tell ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EQ03', 'Scanner HP 2093 ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('EO04', 'Copiadora ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('DG02', 'Edicion Video ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('PU02', 'Millar volantes color ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('RE01', 'Formateo de Laptop ');
INSERT INTO Product_Type(product_type_cd,name_prod)
VALUES('RE02', 'Cambio de memoria ram ');


--------------------------------
---registro de cuentas
--------------------------------
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('101', '2002-01-01','2009-01-01','2008-11-23','Active','4000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('102', '1990-01-01','2010-01-01','2008-11-01','Inactive','100');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('103', '2002-01-01','2009-01-01','2008-11-23','Active','4000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('104', '1995-01-01','2004-01-01','2000-01-03','Inactive','1000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('105', '1988-01-01','2000-01-01','1989-11-23','Inactive','2600');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('106', '2002-01-01','2009-01-01','2008-11-23','Active','2500');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('107', '2002-03-01','2009-01-01','2008-11-23','Active','2600');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('108', '2002-01-01','2004-01-01','2003-09-01','Active','2000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('109', '1999-01-01','2009-01-01','2004-11-23','Active','1500');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('110', '2003-03-01','2010-01-01','2008-02-11','Inactive','2600');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('110', '2001-01-01','2009-01-01','2008-03-12','Inactive','3000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('111', '2002-04-01','2009-01-01','2008-11-23','Active','40000');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('112', '2007-01-01','2009-01-01','2008-11-23','Active','100');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('113', '2006-01-01','2010-01-01','2008-11-23','Inactive','50');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('114', '2002-08-01','2004-01-01','2002-11-23','Inactive','2700');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('115', '1999-01-01','2004-01-01','2002-11-23','Active','2700');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('116', '1995-01-01','2004-01-01','2002-11-23','Active','2500');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('117', '2000-01-01','2009-01-01','2005-12-23','Inactive','700');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('118', '1996-01-01','2004-01-01','2003-11-23','Active','1500');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('119', '1997-01-01','2005-01-01','2003-11-01','Active','2400');
INSERT INTO
account(account_id,open_date,close_date,last_activity_date,status_acc,ava
n_balance)
VALUES('120', '1997-01-01','2005-01-01','2004-11-01','Active','2501');


--------------------------------
---registro de transaciones
--------------------------------
INSERT INTO "transaction"(txn_id,txn_date,account_id, txn_type_cd,amount,
funds_avail_date)
VALUES('1', '20050222','101','CDT','1000','20050222');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('2', '20050223','102','CDT','525.75','20050223');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('3', '20050224','101','DBT','100','20050224');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('4', '20050224','103','CDT','55','20050224');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('5', '20050225','101','DBT','50','20050225');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('6', '20050225','106','CDT','100','20050225');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('7', '20050225','102','CDT','125.37','20050225');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('8', '20050226','103','DBT','10','20050226');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('9', '20050226','101','CDT','75','20050226');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('10', '20050226','103','CDT','30','20050226');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('11', '20050227','102','DBT','100','20050227');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('12', '20050228','101','CDT','80','20050228');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('13', '20050228','104','DBT','200','20050228');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('14', '20050228','106','CDT','1000','20050228');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('15', '20050301','101','CDT','70','20050301');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('16', '20050301','107','DBT','1000','20050301');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('17', '20050301','111','CDT','2000','20050301');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('18', '20050302','104','DBT','200','20050302');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('19', '20050303','106','CDT','900','20050303');
INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount,
funds_avail_date)
VALUES('20', '20050304','101','CDT','1000','20050222');

--------------------------------
---registro de empleados
--------------------------------
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('1', 'Michael', 'Smith','2003-02-03','2008-11-12', '1','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('2', 'Susan', 'barker', '2003-02-03','2009-11-12', '2','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('3', 'Robert', 'Tyler', '2004-03-12','2009-11-12', '1',' Ejecutivo
de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('4', 'Susan', 'Hawthorne', '2003-02-03','2009-11-12', '2','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('5', 'John', 'Gooding', '2004-03-12','2010-11-12', '3','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('6', 'Helen', 'Fleming', '2008-03-12','2011-12-12', '1','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('7', 'Chris', 'Turcker', '2002-01-01','2005-11-06', '4','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('8', 'Sarah', 'Turcker', '2002-01-01','2005-11-06', '4','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('9', 'Jane', 'Grossman', '2001-01-01','2010-01-01', '5','
Supervisor');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('10', 'Paula', 'Robers', '2009-01-01','2011-06-01', '4','
Ejecutivo de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('11', 'Thomas', 'Ziegler', '2009-01-01','2011-06-01', '2','
Ejecutivo de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('12', 'Samantha', 'Jameson', '2003-01-01','2010-06-01', '1','
Ejecutivo de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('13', 'John', 'Jameson', '2001-01-01','2004-06-01', '1','
Ejecutivo de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('14', 'Cindy', 'Mason', '2003-01-01','2005-06-01', '2',' Ejecutivo
de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('15', 'Frank', 'Portman', '2000-01-01','2007-07-07', '3','
Ejecutivo de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('16', 'Theresa', 'Markman', '2001-03-01','2007-12-01', '3','
Auxiliar de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('17', 'Beth', 'Flower', '2001-03-01','2008-12-01', '1',' Auxiliar
de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('18', 'Rick', 'Tulman', '2001-04-03','2011-12-01', '2',' Auxiliar
de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('18', 'Ray', 'Zagart', '2001-01-03','2011-02-01', '5',' Auxiliar
de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('19', 'Alexander', 'Leccardi', '2000-11-13','2011-01-01', '4','
Auxiliar de ventas');
INSERT INTO employee(emp_id, fname_emp, lname_emp,
"start_date",end_date,dept_id, title)
VALUES('20', 'Sam', 'Maslow', '2000-11-13','2011-03-01', '8',' Auxiliar
de ventas');



--------------------------------
---registro de departamentos
--------------------------------
INSERT INTO Department(dept_id, name_dept)
VALUES('01', 'Reparaciones de equipo de computo');
INSERT INTO Department(dept_id, name_dept)
VALUES('02', 'Equipo de computo');
INSERT INTO Department(dept_id, name_dept)
VALUES('03', 'Ventas');
INSERT INTO Department(dept_id, name_dept)
VALUES('04', 'Utiles escolares');
INSERT INTO Department(dept_id, name_dept)
VALUES('05', 'Mercadoctenia');
INSERT INTO Department(dept_id, name_dept)
VALUES('06', 'Equipo y muebleria de oficina');
INSERT INTO Department(dept_id, name_dept)
VALUES('07', 'Articulos Artisticos');
INSERT INTO Department(dept_id, name_dept)
VALUES('08', 'Copias e impresiones');
INSERT INTO Department(dept_id, name_dept)
VALUES('09', 'Diseño grafico');
INSERT INTO Department(dept_id, name_dept)
VALUES('10', 'Material empresarial');
INSERT INTO Department(dept_id, name_dept)
VALUES('11', 'Publicidad');


--------------------------------
---registro de clientes
--------------------------------
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('1', 'BEI900503','OF', '200 Millan Rose', 'Mexico','91500');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('2', 'GAM760530','BS', '25 España ', 'Veracruz','91700');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('3', 'ZAB911130','BS', '45 Vista del mar ', 'Veracruz','91700');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('4', 'SAV910103','IN', '25 Sol de Verano ', 'Oaxaca','91401');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('5', 'SAD910503','IN', '25 Sol de Verano ', 'Mexico','91401');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('6', 'MAP910304','OF', '45 New Sun ', 'The angeles','10421');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('7', 'CAP900110','BS', '146 Art 123 ', 'Nuevo Leon','10400');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('8', 'CHR890214','IN', '146 Amaranto', 'Veracruz','91701');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('9', 'BAA921116','BS', '23 Sol Naciente', 'Oaxaca','91421');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('10', 'GAR911220','OF', '5343 American', 'New York','54332');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('11', 'ESA880310','OF', '33 20 Noviembre', 'Veracruz','91942');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('12', 'SEA891130','IN', '20 Chapultepec', 'Veracruz','93232');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('13', 'ASE921201','IN', '23 Ortiz Rubio', 'Veracruz','91312');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('14', 'SEL930411','BS', '123 Margarita', 'Oaxaca','90012');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('15', 'SAL910512','OF', '304 Isamara', 'Nuevo Leon','81012');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('16', 'ANL910129','IN', '34 Americas', 'California','21012');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('17', 'LAN921209','IN', '334 Chapultepec', 'Mexico','91019');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('18', 'ANS640209','BS', '394 Arista', 'Mexico','31119');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('19', 'SAM790211','BS', '204 Blue station', 'New York','11419');
INSERT INTO customer(cust_id,
fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust)
VALUES('20', 'ESP990722','IN', '204 Pasteur', 'Veracruz','91932');


--------------------------------
---registro de clientes individuales
--------------------------------
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('4', 'Laura','Perez', '1991-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('5', 'Gerardo','Gutierrez', '1989-01-22');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('8', 'Esmeralda','Milan', '1990-11-11');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('12', 'chistian','Jacome', '1988-01-15');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('13', 'Esperanza','Barrada', '1990-11-30');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('16', 'Rodrigo','Campos', '1977-05-24');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('17', 'Jason','Parker', '1981-04-14');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('20', 'Willy','Gomez', '1989-09-12');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('21', 'Jorge','Perez', '1987-12-10');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('50', 'Samantha','Rodriguez', '1991-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('660', 'Arely','Zamora', '1993-09-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('312', 'Catalina','Gutierrez', '1991-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('45', 'Carlos','Solano', '1990-01-11');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('47', 'Enrique','Garcia', '1990-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('48', 'Guadalupe','Jimenez', '1981-03-25');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('94', 'Andres','Granda', '1988-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('34', 'Isabel','Martinez', '1966-08-04');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('46', 'Sergioo','Basalles', '1971-09-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('454', 'Erick','Garcia', '1991-02-21');
INSERT INTO individual(cust_id, fname,lname,birth_date)
VALUES('456', 'Eduardo','Campos', '1991-12-21');


--------------------------------
---registro de clientes empresariales
--------------------------------
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('2', 'Fachess','VZ932', '1970-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('3', 'Myspace','VZ933', '1972-02-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('7', 'GOMSA logistica','VZ934', '1950-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('14', 'Estafeta','VZ931', '1950-01-31');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('18', 'Habiplat México','MX132', '1990-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('313', 'Grupo Bimbo','MX2432', '1870-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('477', 'Famsa','VZ932', '1970-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('675', 'elektra','VZ932', '1956-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('437', 'Terra','VZ202', '1980-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('246', 'Multipack','VZ102', '1976-01-11');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('23', 'Buro Nacional de recursos humanos','OX932', '1970-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('21', 'One Digit','VZ900', '1980-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('22', 'Seguros Banorte','MX122', '1950-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('26', 'Fundidora dobbie','VZ402', '1990-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('29', 'Efectivale','MX100', '2000-01-01');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('40', 'Plasticos libertad','VZ966', '1970-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('30', 'Aba Seguros','VZ636', '1980-01-02');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('225', 'Axa Seguros','VZ132', '1999-01-12');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('66', 'Grupo intercom comercial','MY122', '2000-01-05');
INSERT INTO business(cust_id, name_business,state_id,incorp_date)
VALUES('674', 'Plasticos Habel','VZ902', '1990-01-01');


--------------------------------
---registro de clientes de oficina
--------------------------------
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('1', '1','Alejandro', 'Viñeda','Gerente','2001-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('2', '6','Mathilda', 'Cepeda','Supervisor','2005-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('3', '10','Jaqueline', 'Jimenez','Gerente','2003-01-01','2009-01-
11');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('4', '11','Esperanza', 'Espejo','Supervisor','2005-01-01','2010-
01-31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('5', '15','Roberto', 'Cepeda','Supervisor','2007-01-01','2011-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('6', '55','Arturo', 'Silva','Gerente','2001-01-01','2009-01-01');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('7', '64','Ismael', 'Zuñiga','Supervisor','2001-01-01','2006-01-
21');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('8', '67','Mathilda', 'Colins','Supervisor','2000-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('9', '30','Sandra', 'Cedeño','Supervisor','2005-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('10', '60','Dora', 'Dominguez','Supervisor','2011-01-01','2011-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('11', '50','Manuel', 'Torres','Supervisor','2000-01-01','2005-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('12', '66','Arturo', 'Cepeda','Supervisor','2005-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('13', '67','Enrique', 'Martinez','Gerente','2001-01-01','2008-01-
01');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('14', '69','Mathilda', 'Cepeda','Supervisor','2005-01-01','2010-
01-31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('15', '86','Horlando', 'Campos','Gerente','2006-01-01','2010-01-
21');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('16', '575','Ismael', 'Cepeda','Supervisor','2005-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('17', '754','Juan', 'Rodriguez','Supervisor','2005-01-01','2010-
01-31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('18', '422','Ignacio', 'Solano','Supervisor','2001-01-01','2009-
01-01');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('19', '96','Jose', 'Reyes','Supervisor','2005-01-01','2010-01-
31');
INSERT INTO officer(officer_id,
cust_id,fname,lname,title,"start_date",end_date)
VALUES('20', '866','Carlos', 'Garcia','Supervisor','1991-01-01','2000-01-
31');

1

Recupere el ID de empleado, el nombre y el apellido de todos los empleados delbanco.
Ordene por apellido y nombre.

SELECT emp_id_fname_emp_lname_emp

From employee

Order by i name_emp,fname;




7 Construya una consulta que recupere todas las cuentas abiertas en 2002.




SELECT
account_id,open_date,close_date,last_activity_date,status_acc,avan_balanc
e
from account
where YEAR(open_date)=2002;
Sql ejercicio 1

Mais conteúdo relacionado

Mais procurados

Relational DB Course
Relational DB  Course Relational DB  Course
Relational DB Course Sunny U Okoro
 
Database Manipulation in SQL
Database Manipulation in SQLDatabase Manipulation in SQL
Database Manipulation in SQLJack Clark
 
Practicas oracle10g
Practicas oracle10gPracticas oracle10g
Practicas oracle10grehoscript
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumnameEmanuele Quinto
 

Mais procurados (7)

Relational DB Course
Relational DB  Course Relational DB  Course
Relational DB Course
 
Database Manipulation in SQL
Database Manipulation in SQLDatabase Manipulation in SQL
Database Manipulation in SQL
 
4sem dbms(1)
4sem dbms(1)4sem dbms(1)
4sem dbms(1)
 
Practicas oracle10g
Practicas oracle10gPracticas oracle10g
Practicas oracle10g
 
Employ leave dtb
Employ leave dtbEmploy leave dtb
Employ leave dtb
 
Script oracle
Script oracleScript oracle
Script oracle
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumname
 

Semelhante a Sql ejercicio 1

Actividad 1 de unidad 4
Actividad 1 de unidad 4Actividad 1 de unidad 4
Actividad 1 de unidad 4sergio
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.phpssuserfa5723
 
Database Implementation Final Document
Database Implementation Final DocumentDatabase Implementation Final Document
Database Implementation Final DocumentConor O'Callaghan
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所Hiroshi Sekiguchi
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by Visakh V
 
Oracle Web Adi For upload item master
Oracle Web Adi For upload item masterOracle Web Adi For upload item master
Oracle Web Adi For upload item masterAhmed Elshayeb
 
Inventory aging report using oracle discoverer desktop
Inventory aging report using oracle discoverer desktopInventory aging report using oracle discoverer desktop
Inventory aging report using oracle discoverer desktopAhmed Elshayeb
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfarrowit1
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013Connor McDonald
 
Sql
SqlSql
SqlJoao
 
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docxcreate_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docxfaithxdunce63732
 
Sybase to oracle_conversion
Sybase to oracle_conversionSybase to oracle_conversion
Sybase to oracle_conversionSam Varadarajan
 
Raw system logs processing with hive
Raw system logs processing with hiveRaw system logs processing with hive
Raw system logs processing with hiveArpit Patil
 

Semelhante a Sql ejercicio 1 (20)

Actividad 1 de unidad 4
Actividad 1 de unidad 4Actividad 1 de unidad 4
Actividad 1 de unidad 4
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 
my_project
my_projectmy_project
my_project
 
Database Implementation Final Document
Database Implementation Final DocumentDatabase Implementation Final Document
Database Implementation Final Document
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by
 
Oracle Web Adi For upload item master
Oracle Web Adi For upload item masterOracle Web Adi For upload item master
Oracle Web Adi For upload item master
 
Inventory aging report using oracle discoverer desktop
Inventory aging report using oracle discoverer desktopInventory aging report using oracle discoverer desktop
Inventory aging report using oracle discoverer desktop
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
Benforta
BenfortaBenforta
Benforta
 
Benforta
BenfortaBenforta
Benforta
 
Sql commands
Sql commandsSql commands
Sql commands
 
Quick reference for hql
Quick reference for hqlQuick reference for hql
Quick reference for hql
 
Sql
SqlSql
Sql
 
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docxcreate_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
 
Zmalv output type_v1.1
Zmalv output type_v1.1Zmalv output type_v1.1
Zmalv output type_v1.1
 
Sybase to oracle_conversion
Sybase to oracle_conversionSybase to oracle_conversion
Sybase to oracle_conversion
 
Raw system logs processing with hive
Raw system logs processing with hiveRaw system logs processing with hive
Raw system logs processing with hive
 

Mais de Jillian Motoharu (11)

Introd admon-cal
Introd admon-calIntrod admon-cal
Introd admon-cal
 
Gomsa
GomsaGomsa
Gomsa
 
Gomsa
GomsaGomsa
Gomsa
 
Tabla comparativa
Tabla comparativaTabla comparativa
Tabla comparativa
 
Cuadro comparativo sql
Cuadro comparativo sqlCuadro comparativo sql
Cuadro comparativo sql
 
Sql server2008 caract
Sql server2008 caractSql server2008 caract
Sql server2008 caract
 
Cuadro comparativo sql
Cuadro comparativo sqlCuadro comparativo sql
Cuadro comparativo sql
 
Diferentes versiones sql server
Diferentes versiones sql serverDiferentes versiones sql server
Diferentes versiones sql server
 
Componentes de sql server 2008
Componentes de sql server 2008Componentes de sql server 2008
Componentes de sql server 2008
 
SMBD 2011
SMBD 2011SMBD 2011
SMBD 2011
 
SMBD 2011
SMBD 2011SMBD 2011
SMBD 2011
 

Último

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Sql ejercicio 1

  • 1. ----------------------------------------------------------- -- SQL ejercicio 1 ----------------------------------------------------------- ----------------------- -- Tabla Branch ----------------------- CREATE TABLE Branch ( branch_id int NOT NULL, name_br varchar(20) NOT NULL , adress_br varchar(30) NULL , city_br varchar(20) NULL , state_br varchar(2) NULL , zip_br varchar(12) NULL, ); ----------------------- -- tabla employee ----------------------- CREATE TABLE employee ( emp_id int NOT NULL, fname_emp varchar(20) NOT NULL , lname_emp varchar (20) NOT NULL, "start_date" date NOT NULL , end_date date NOT NULL, dept_id int NOT NULL, title varchar(20) NULL, ); ----------------------- ----------------------- -- tabla departamento ----------------------- CREATE TABLE Department ( dept_id int NOT NULL , name_dept varchar(20) NOT NULL , ); ----------------------- ----------------------- -- tabla producto ----------------------- CREATE TABLE Product ( product_cd varchar(10) NOT NULL, name_prod varchar(50) NOT NULL , date_offered date NULL , date_retired date NULL, ); ----------------------- ----------------------- -- tabla tipo de producto
  • 2. ----------------------- CREATE TABLE Product_Type ( product_type_cd varchar(10) NOT NULL, name_prod varchar(50) NOT NULL , ); ----------------------- ----------------------- -- tabla cuenta ----------------------- CREATE TABLE account ( account_id int NOT NULL , product_cd varchar(10) NULL, cust_id int NOT NULL, open_date date NULL, close_date date NULL, last_activity_date date NULL, status_acc varchar(10) NULL, avan_balance float(10) NULL, open_brach_id int NOT NULL ); ----------------------- ----------------------- -- tabla transaciones ----------------------- CREATE TABLE "transaction" ( txn_id int NOT NULL, txn_date datetime NOT NULL , account_id int NOT NULL, txn_type_cd varchar(10) NULL , amount decimal(10,2) NOT NULL, funds_avail_date datetime NULL, ); ----------------------- ----------------------- -- tabla Clientes ----------------------- CREATE TABLE customer ( cust_id int NOT NULL, fed_id varchar (12) NOT NULL, cust_type_cd varchar (2) NOT NULL , adress_cust varchar(30) NULL , city_cust varchar(20) NULl, "state_cust" varchar(20) NULL, postal_code_cust varchar(20) NULL ); -----------------------
  • 3. ----------------------- -- tabla Clientes empresarios ----------------------- CREATE TABLE business ( cust_id int NOT NULL, name_business varchar (40) NULL , state_id varchar(10) NULL , incorp_date date NULL, ); ----------------------- ----------------------- -- Tabla de Clientes Oficinas ----------------------- CREATE TABLE officer ( officer_id int NOT NULL, cust_id int NOT NULL, fname varchar (30) NULL , lname varchar (30) NULL , title varchar (20) NULL, "start_date" date NULL, end_date date null, ); ----------------------- ----------------------- -- Tabla de Clientes Individuales ----------------------- CREATE TABLE individual ( cust_id int NOT NULL, fname varchar (30) NULL , lname varchar (30) NULL , birth_date date NULL, ); ----------------------- ---------------------- -- Define primary keys ---------------------- ALTER TABLE Branch WITH NOCHECK ADD CONSTRAINT PK_Branch PRIMARY KEY CLUSTERED (Branch_id); ALTER TABLE Employee WITH NOCHECK ADD CONSTRAINT PK_employee PRIMARY KEY CLUSTERED (emp_id); ALTER TABLE product WITH NOCHECK ADD CONSTRAINT PK_productc PRIMARY KEY CLUSTERED (product_cd); ALTER TABLE Product_Type_cd WITH NOCHECK ADD CONSTRAINT PK_Product_Type PRIMARY KEY CLUSTERED (product_cd); ALTER TABLE Department WITH NOCHECK ADD CONSTRAINT PK_Department PRIMARY KEY CLUSTERED (dept_id); ALTER TABLE account WITH NOCHECK ADD CONSTRAINT PK_account PRIMARY KEY CLUSTERED (account_id); ALTER TABLE "transaction" WITH NOCHECK ADD CONSTRAINT PK_trasaction PRIMARY KEY CLUSTERED ( txn_id);
  • 4. ALTER TABLE customer WITH NOCHECK ADD CONSTRAINT PK_customer PRIMARY KEY CLUSTERED ( cust_id); ALTER TABLE individual WITH NOCHECK ADD CONSTRAINT PK_individual PRIMARY KEY CLUSTERED ( cust_id); ALTER TABLE business WITH NOCHECK ADD CONSTRAINT PK_business PRIMARY KEY CLUSTERED ( cust_id); ALTER TABLE officer WITH NOCHECK ADD CONSTRAINT PK_officer PRIMARY KEY CLUSTERED ( officer_id); ---------------------- -- Define foreign keys ---------------------- ALTER TABLE Product ADD CONSTRAINT FK_product_type_cd FOREIGN KEY (product_cd) REFERENCES product (product_cd); ALTER TABLE account ADD CONSTRAINT FK_product_cd FOREIGN KEY (product_cd) REFERENCES product(product_cd), CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id), CONSTRAINT FK_open_branch_id FOREIGN KEY (branch_id) REFERENCES branch(branch_id), CONSTRAINT FK_open_emp_id FOREIGN KEY (emp_id) REFERENCES employee(emp_id); ALTER TABLE officer ADD CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES bussiness (cust_id); ALTER TABLE business ADD CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id); ALTER TABLE individual ADD CONSTRAINT FK_cust_id FOREIGN KEY (cust_id) REFERENCES customer(cust_id); ALTER TABLE employee ADD CONSTRAINT FK_dept_id FOREIGN KEY (dept_id) REFERENCES departament(dept_id), CONSTRAINT FK_assined_branch_id FOREIGN KEY (branch_id) REFERENCES branch(branch_id), CONSTRAINT FK_superior_emp_id FOREIGN KEY (emp_id) REFERENCES employee(emp_id); ALTER TABLE "transaction" ADD CONSTRAINT FK_execution_branch_id FOREIGN KEY (brach_id) REFERENCES branch (branch_id), CONSTRAINT FK_emp_id FOREIGN KEY (emp_id) REFERENCES employee (emp_id), CONSTRAINT FK_account_id FOREIGN KEY (account_id) REFERENCES account (account_id);
  • 5. -------------------------------- ---registro de sucursal -------------------------------- INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br, zip_br) VALUES('1000000001', 'The angeles', '200 Agust Flor', 'Angeles', 'AP', '44444'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000002', 'Las americas', '300 Americo Vespucio', 'Veracruz', 'MX', '92464'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000003', 'J Paulling Salazar', '45 vistamar ', 'Veracruz', 'VR', '12444'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000004', 'Sunday', '566-A España ', 'Distrito Federal', 'MX', '52464'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000005', 'Altamirano', '567 Dictamen ', 'Guadalajara', 'GA', '33346'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000006', 'Espino Suarez', '744 Buena Vista ', 'Oaxaca', 'OX', '84646'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000007', 'Serfin', '352 Bella vista ', 'Buenos Aires', 'BA', '454543'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000008', 'Banserfi', '564 Isidro ', 'Santiago', 'TM', '454542'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000009', 'American ', '564 Familia ', 'Nuevo leon', 'MY', '454542'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000010', 'Santa Maria', '4543 Elena Olivares ', 'Tampico', 'VZ', '454542'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000011', 'The cid', '5453 Puesta del sol ', 'Veracruz', 'vz', '454542'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000012', 'Zachizone', '553 Amaranto ', 'Zachila', 'OX', '454542'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br)
  • 6. VALUES('1000000013', 'Primero de mayo', '5434 Centro ', 'Veracruz', 'VZ', '5945322'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000014', '20 de noviembre', '365 20 de noviembre ', 'Veracruz', 'VZ', '5945442'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000015', 'Milan', '365 20 de noviembre ', 'Veracruz', 'VZ', '5945442'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000016', 'felicidad', '34 20 de noviembre ', 'Veracruz', 'VZ', '5945436'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000017', 'Astillero', '8676 Mateo', 'cordoba', 'VZ', '5945442'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000018', 'Villa', '64 Villa Pequeña', 'Xalapa', 'VZ', '1944442'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000019', 'Los pinos', '644 Los pinos', 'Perote', 'VZ', '295442'); INSERT INTO Branch(branch_id, name_br, adress_br, city_br, state_br,zip_br) VALUES('1000000020', 'Santiago', '44 Gutierrez Morales', 'Nuevo Leon', 'MY', '655442'); -------------------------------- ---registro de productos -------------------------------- INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('BON01', 'Papel Bond Sol', '2010-02-02', '2010-03-06'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('LAG01', 'Lapiz Grafito Print ', '2010-01-31', '2010-02-22'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('FOCB1', 'Fomi carta brillante ', '2010-01-31', '2010-02-22'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('SSTI1', 'Sony Tinta Impresora ', '2010-02-05', '2010-02-26'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('DDL01', 'Durometro de lapiz ', '2010-02-06', '2010-03-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('VMC01', 'Volantes media carta ', '2010-02-06', '2010-03-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('GEC42', 'Grapas estandar alterk plus ', '2010-01-06', '2010-03- 01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('IMA01', 'Imanes ok impresos', '2010-03-06', '2010-04-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('MART1', 'Marcatextos', '2010-03-06', '2010-04-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('POFV1', 'Postales A color', '2010-04-06', '2010-05-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('CLIP1', 'Clip alterkl plus', '2010-02-06', '2010-05-01');
  • 7. INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('FTC01', 'Folder Carta Alterkl plus', '2010-02-06', '2010-05-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('MTB02', 'Marca texto borrable', '2010-02-10', '2010-05-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('MBF01', 'Marcador para billetes falsos Check it azoe', '2010-02- 10', '2010-05-01'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('HC001', 'Hojas color millar', '2011-01-01', '2011-01-31'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('FCC01', 'archivador', '2011-01-03', '2011-09-31'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('EM001', 'equipo multifuncion', '2010-01-03', '2011-01-31'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('DP002', 'destructora de papel', '2010-01-01', '2011-01-31'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('RF001', 'Regla flexible Shelly', '2011-02-03', '2011-01-31'); INSERT INTO Product(product_cd, name_prod, date_offered, date_retired) VALUES('CCP01', 'Chinche Color 100 Piezas', '2011-02-03', '2011-01-31'); -------------------------------- ---registro de tipos de productos -------------------------------- INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EQ01', 'Computadora de escritorio HP'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EQ02', 'Laptop Toshiba Satellite'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('CI01', 'Copia BYN 80%'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('CI02', 'Copia BYN 100%'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('PU01', 'Poster C. 50x50'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('AA01', 'Lapiz Grafito para dibujar Big'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('DG01', 'Edicion Imagen N1'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('UE01', 'Lapiz n°2 Milano '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('DG02', 'Edicion Imagen N2 '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('AA02', 'Hojas de dibujo Cari '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('AA03', 'Paleta para pintar SER'); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EO01', 'Escritorio estandar oficina Bell '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EO02', 'Maquina de escribir Olympia '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EO03', 'Trituradora de papel Tell '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EQ03', 'Scanner HP 2093 '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('EO04', 'Copiadora ');
  • 8. INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('DG02', 'Edicion Video '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('PU02', 'Millar volantes color '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('RE01', 'Formateo de Laptop '); INSERT INTO Product_Type(product_type_cd,name_prod) VALUES('RE02', 'Cambio de memoria ram '); -------------------------------- ---registro de cuentas -------------------------------- INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('101', '2002-01-01','2009-01-01','2008-11-23','Active','4000'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('102', '1990-01-01','2010-01-01','2008-11-01','Inactive','100'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('103', '2002-01-01','2009-01-01','2008-11-23','Active','4000'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('104', '1995-01-01','2004-01-01','2000-01-03','Inactive','1000'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('105', '1988-01-01','2000-01-01','1989-11-23','Inactive','2600'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('106', '2002-01-01','2009-01-01','2008-11-23','Active','2500'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('107', '2002-03-01','2009-01-01','2008-11-23','Active','2600'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('108', '2002-01-01','2004-01-01','2003-09-01','Active','2000'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('109', '1999-01-01','2009-01-01','2004-11-23','Active','1500'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('110', '2003-03-01','2010-01-01','2008-02-11','Inactive','2600'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('110', '2001-01-01','2009-01-01','2008-03-12','Inactive','3000');
  • 9. INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('111', '2002-04-01','2009-01-01','2008-11-23','Active','40000'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('112', '2007-01-01','2009-01-01','2008-11-23','Active','100'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('113', '2006-01-01','2010-01-01','2008-11-23','Inactive','50'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('114', '2002-08-01','2004-01-01','2002-11-23','Inactive','2700'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('115', '1999-01-01','2004-01-01','2002-11-23','Active','2700'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('116', '1995-01-01','2004-01-01','2002-11-23','Active','2500'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('117', '2000-01-01','2009-01-01','2005-12-23','Inactive','700'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('118', '1996-01-01','2004-01-01','2003-11-23','Active','1500'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('119', '1997-01-01','2005-01-01','2003-11-01','Active','2400'); INSERT INTO account(account_id,open_date,close_date,last_activity_date,status_acc,ava n_balance) VALUES('120', '1997-01-01','2005-01-01','2004-11-01','Active','2501'); -------------------------------- ---registro de transaciones -------------------------------- INSERT INTO "transaction"(txn_id,txn_date,account_id, txn_type_cd,amount, funds_avail_date) VALUES('1', '20050222','101','CDT','1000','20050222'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('2', '20050223','102','CDT','525.75','20050223'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('3', '20050224','101','DBT','100','20050224'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('4', '20050224','103','CDT','55','20050224');
  • 10. INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('5', '20050225','101','DBT','50','20050225'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('6', '20050225','106','CDT','100','20050225'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('7', '20050225','102','CDT','125.37','20050225'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('8', '20050226','103','DBT','10','20050226'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('9', '20050226','101','CDT','75','20050226'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('10', '20050226','103','CDT','30','20050226'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('11', '20050227','102','DBT','100','20050227'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('12', '20050228','101','CDT','80','20050228'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('13', '20050228','104','DBT','200','20050228'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('14', '20050228','106','CDT','1000','20050228'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('15', '20050301','101','CDT','70','20050301'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('16', '20050301','107','DBT','1000','20050301'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('17', '20050301','111','CDT','2000','20050301'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('18', '20050302','104','DBT','200','20050302'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('19', '20050303','106','CDT','900','20050303'); INSERT INTO "transaction"(txn_id,txn_date,account_id,txn_type_cd,amount, funds_avail_date) VALUES('20', '20050304','101','CDT','1000','20050222'); -------------------------------- ---registro de empleados -------------------------------- INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('1', 'Michael', 'Smith','2003-02-03','2008-11-12', '1',' Supervisor');
  • 11. INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('2', 'Susan', 'barker', '2003-02-03','2009-11-12', '2',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('3', 'Robert', 'Tyler', '2004-03-12','2009-11-12', '1',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('4', 'Susan', 'Hawthorne', '2003-02-03','2009-11-12', '2',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('5', 'John', 'Gooding', '2004-03-12','2010-11-12', '3',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('6', 'Helen', 'Fleming', '2008-03-12','2011-12-12', '1',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('7', 'Chris', 'Turcker', '2002-01-01','2005-11-06', '4',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('8', 'Sarah', 'Turcker', '2002-01-01','2005-11-06', '4',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('9', 'Jane', 'Grossman', '2001-01-01','2010-01-01', '5',' Supervisor'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('10', 'Paula', 'Robers', '2009-01-01','2011-06-01', '4',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('11', 'Thomas', 'Ziegler', '2009-01-01','2011-06-01', '2',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('12', 'Samantha', 'Jameson', '2003-01-01','2010-06-01', '1',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('13', 'John', 'Jameson', '2001-01-01','2004-06-01', '1',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('14', 'Cindy', 'Mason', '2003-01-01','2005-06-01', '2',' Ejecutivo de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('15', 'Frank', 'Portman', '2000-01-01','2007-07-07', '3',' Ejecutivo de ventas');
  • 12. INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('16', 'Theresa', 'Markman', '2001-03-01','2007-12-01', '3',' Auxiliar de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('17', 'Beth', 'Flower', '2001-03-01','2008-12-01', '1',' Auxiliar de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('18', 'Rick', 'Tulman', '2001-04-03','2011-12-01', '2',' Auxiliar de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('18', 'Ray', 'Zagart', '2001-01-03','2011-02-01', '5',' Auxiliar de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('19', 'Alexander', 'Leccardi', '2000-11-13','2011-01-01', '4',' Auxiliar de ventas'); INSERT INTO employee(emp_id, fname_emp, lname_emp, "start_date",end_date,dept_id, title) VALUES('20', 'Sam', 'Maslow', '2000-11-13','2011-03-01', '8',' Auxiliar de ventas'); -------------------------------- ---registro de departamentos -------------------------------- INSERT INTO Department(dept_id, name_dept) VALUES('01', 'Reparaciones de equipo de computo'); INSERT INTO Department(dept_id, name_dept) VALUES('02', 'Equipo de computo'); INSERT INTO Department(dept_id, name_dept) VALUES('03', 'Ventas'); INSERT INTO Department(dept_id, name_dept) VALUES('04', 'Utiles escolares'); INSERT INTO Department(dept_id, name_dept) VALUES('05', 'Mercadoctenia'); INSERT INTO Department(dept_id, name_dept) VALUES('06', 'Equipo y muebleria de oficina'); INSERT INTO Department(dept_id, name_dept) VALUES('07', 'Articulos Artisticos'); INSERT INTO Department(dept_id, name_dept) VALUES('08', 'Copias e impresiones'); INSERT INTO Department(dept_id, name_dept) VALUES('09', 'Diseño grafico'); INSERT INTO Department(dept_id, name_dept) VALUES('10', 'Material empresarial'); INSERT INTO Department(dept_id, name_dept) VALUES('11', 'Publicidad'); -------------------------------- ---registro de clientes --------------------------------
  • 13. INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('1', 'BEI900503','OF', '200 Millan Rose', 'Mexico','91500'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('2', 'GAM760530','BS', '25 España ', 'Veracruz','91700'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('3', 'ZAB911130','BS', '45 Vista del mar ', 'Veracruz','91700'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('4', 'SAV910103','IN', '25 Sol de Verano ', 'Oaxaca','91401'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('5', 'SAD910503','IN', '25 Sol de Verano ', 'Mexico','91401'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('6', 'MAP910304','OF', '45 New Sun ', 'The angeles','10421'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('7', 'CAP900110','BS', '146 Art 123 ', 'Nuevo Leon','10400'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('8', 'CHR890214','IN', '146 Amaranto', 'Veracruz','91701'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('9', 'BAA921116','BS', '23 Sol Naciente', 'Oaxaca','91421'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('10', 'GAR911220','OF', '5343 American', 'New York','54332'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('11', 'ESA880310','OF', '33 20 Noviembre', 'Veracruz','91942'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('12', 'SEA891130','IN', '20 Chapultepec', 'Veracruz','93232'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('13', 'ASE921201','IN', '23 Ortiz Rubio', 'Veracruz','91312'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('14', 'SEL930411','BS', '123 Margarita', 'Oaxaca','90012'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('15', 'SAL910512','OF', '304 Isamara', 'Nuevo Leon','81012'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('16', 'ANL910129','IN', '34 Americas', 'California','21012'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('17', 'LAN921209','IN', '334 Chapultepec', 'Mexico','91019'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('18', 'ANS640209','BS', '394 Arista', 'Mexico','31119'); INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('19', 'SAM790211','BS', '204 Blue station', 'New York','11419');
  • 14. INSERT INTO customer(cust_id, fed_id,cust_type_cd,adress_cust,state_cust,postal_code_cust) VALUES('20', 'ESP990722','IN', '204 Pasteur', 'Veracruz','91932'); -------------------------------- ---registro de clientes individuales -------------------------------- INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('4', 'Laura','Perez', '1991-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('5', 'Gerardo','Gutierrez', '1989-01-22'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('8', 'Esmeralda','Milan', '1990-11-11'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('12', 'chistian','Jacome', '1988-01-15'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('13', 'Esperanza','Barrada', '1990-11-30'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('16', 'Rodrigo','Campos', '1977-05-24'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('17', 'Jason','Parker', '1981-04-14'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('20', 'Willy','Gomez', '1989-09-12'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('21', 'Jorge','Perez', '1987-12-10'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('50', 'Samantha','Rodriguez', '1991-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('660', 'Arely','Zamora', '1993-09-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('312', 'Catalina','Gutierrez', '1991-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('45', 'Carlos','Solano', '1990-01-11'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('47', 'Enrique','Garcia', '1990-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('48', 'Guadalupe','Jimenez', '1981-03-25'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('94', 'Andres','Granda', '1988-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('34', 'Isabel','Martinez', '1966-08-04'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('46', 'Sergioo','Basalles', '1971-09-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('454', 'Erick','Garcia', '1991-02-21'); INSERT INTO individual(cust_id, fname,lname,birth_date) VALUES('456', 'Eduardo','Campos', '1991-12-21'); -------------------------------- ---registro de clientes empresariales -------------------------------- INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('2', 'Fachess','VZ932', '1970-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('3', 'Myspace','VZ933', '1972-02-01');
  • 15. INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('7', 'GOMSA logistica','VZ934', '1950-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('14', 'Estafeta','VZ931', '1950-01-31'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('18', 'Habiplat México','MX132', '1990-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('313', 'Grupo Bimbo','MX2432', '1870-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('477', 'Famsa','VZ932', '1970-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('675', 'elektra','VZ932', '1956-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('437', 'Terra','VZ202', '1980-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('246', 'Multipack','VZ102', '1976-01-11'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('23', 'Buro Nacional de recursos humanos','OX932', '1970-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('21', 'One Digit','VZ900', '1980-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('22', 'Seguros Banorte','MX122', '1950-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('26', 'Fundidora dobbie','VZ402', '1990-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('29', 'Efectivale','MX100', '2000-01-01'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('40', 'Plasticos libertad','VZ966', '1970-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('30', 'Aba Seguros','VZ636', '1980-01-02'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('225', 'Axa Seguros','VZ132', '1999-01-12'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('66', 'Grupo intercom comercial','MY122', '2000-01-05'); INSERT INTO business(cust_id, name_business,state_id,incorp_date) VALUES('674', 'Plasticos Habel','VZ902', '1990-01-01'); -------------------------------- ---registro de clientes de oficina -------------------------------- INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('1', '1','Alejandro', 'Viñeda','Gerente','2001-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('2', '6','Mathilda', 'Cepeda','Supervisor','2005-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('3', '10','Jaqueline', 'Jimenez','Gerente','2003-01-01','2009-01- 11'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('4', '11','Esperanza', 'Espejo','Supervisor','2005-01-01','2010- 01-31');
  • 16. INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('5', '15','Roberto', 'Cepeda','Supervisor','2007-01-01','2011-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('6', '55','Arturo', 'Silva','Gerente','2001-01-01','2009-01-01'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('7', '64','Ismael', 'Zuñiga','Supervisor','2001-01-01','2006-01- 21'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('8', '67','Mathilda', 'Colins','Supervisor','2000-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('9', '30','Sandra', 'Cedeño','Supervisor','2005-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('10', '60','Dora', 'Dominguez','Supervisor','2011-01-01','2011-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('11', '50','Manuel', 'Torres','Supervisor','2000-01-01','2005-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('12', '66','Arturo', 'Cepeda','Supervisor','2005-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('13', '67','Enrique', 'Martinez','Gerente','2001-01-01','2008-01- 01'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('14', '69','Mathilda', 'Cepeda','Supervisor','2005-01-01','2010- 01-31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('15', '86','Horlando', 'Campos','Gerente','2006-01-01','2010-01- 21'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('16', '575','Ismael', 'Cepeda','Supervisor','2005-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('17', '754','Juan', 'Rodriguez','Supervisor','2005-01-01','2010- 01-31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('18', '422','Ignacio', 'Solano','Supervisor','2001-01-01','2009- 01-01'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date)
  • 17. VALUES('19', '96','Jose', 'Reyes','Supervisor','2005-01-01','2010-01- 31'); INSERT INTO officer(officer_id, cust_id,fname,lname,title,"start_date",end_date) VALUES('20', '866','Carlos', 'Garcia','Supervisor','1991-01-01','2000-01- 31'); 1 Recupere el ID de empleado, el nombre y el apellido de todos los empleados delbanco. Ordene por apellido y nombre. SELECT emp_id_fname_emp_lname_emp From employee Order by i name_emp,fname; 7 Construya una consulta que recupere todas las cuentas abiertas en 2002. SELECT account_id,open_date,close_date,last_activity_date,status_acc,avan_balanc e from account where YEAR(open_date)=2002;