SlideShare a Scribd company logo
1 of 6
---+--------------------+ 
| codigo | nombre | cargo | f_ingreso | salario | comision | cod_d 
ep | departamento_codep | 
+--------+----------------+------------+------------+---------+----------+------ 
---+--------------------+ 
| 7369 | Carlos Perdomo | SUPERVISOR | 0000-00-00 | 800 | 50 | 
20 | 10 | 
| 7499 | Fernando Velez | VENDEDOR | 0000-00-00 | 1600 | 300 | 
30 | 20 | 
| 7521 | Rosario Gomez | VENDEDOR | 0000-00-00 | 2975 | 200 | 
20 | 30 | 
+--------+----------------+------------+------------+---------+----------+------ 
---+--------------------+ 
3 rows in set (0.00 sec) 
mysql> show databases; 
+--------------------+ 
| Database | 
+--------------------+ 
| information_schema | 
| empresa | 
| mysql | 
+--------------------+ 
3 rows in set (0.00 sec) 
mysql> drop database empresa; 
Query OK, 2 rows affected (0.10 sec) 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> create database empresa; 
Query OK, 1 row affected (0.01 sec) 
mysql> use empresa; 
Database changed 
mysql> 
mysql> 
mysql> 
mysql> create table departamento 
-> (codep integer(30) PRIMARY KEY, 
-> nombre_der varchar(30), 
-> ubicacion varchar(30)); 
Query OK, 0 rows affected (0.05 sec) 
mysql> 
mysql> insert into departamento 
-> values(10,'contabilidad','cali'); 
Query OK, 1 row affected (0.02 sec) 
mysql> 
mysql> insert into departamento 
-> values(20,'investigacion','bogota'); 
Query OK, 1 row affected (0.02 sec) 
mysql> 
mysql> insert into departamento 
-> values(30,'ventas','manizales'); 
Query OK, 1 row affected (0.02 sec) 
mysql> select * from departamento; 
+-------+---------------+-----------+
| codep | nombre_der | ubicacion | 
+-------+---------------+-----------+ 
| 10 | contabilidad | cali | 
| 20 | investigacion | bogota | 
| 30 | ventas | manizales | 
+-------+---------------+-----------+ 
3 rows in set (0.00 sec) 
mysql> 
mysql> 
mysql> create table empleado 
-> (codigo integer, 
-> nombre varchar(30), 
-> cargo varchar(30), 
-> f_ingreso date, 
-> salario integer, 
-> comision integer, 
-> 
-> departamento_codep integer, 
-> PRIMARY KEY (codigo), 
-> FOREIGN KEY(departamento_codep) 
-> REFERENCES departamento(codep) 
-> ON DELETE NO ACTION 
-> ON UPDATE NO ACTION 
-> ); 
Query OK, 0 rows affected (0.06 sec) 
mysql> insert into empleado 
-> values(7369,'Carlos Perdomo','SUPERVISOR',1980-12-17,800,50,20); 
Query OK, 1 row affected, 1 warning (0.03 sec) 
mysql> 
mysql> insert into empleado 
-> values(7499,'Fernando Velez','VENDEDOR',1981-02-20,1600,300,30); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7521,'Rosario Gomez','VENDEDOR',1981-12-22,2975,200,30); 
Query OK, 1 row affected, 1 warning (0.01 sec) 
mysql> 
mysql> insert into empleado 
-> values(7566,'Jones Wilson','AUXILIAR',1981-04-21,2975,200,20); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7654,'Martin Vanegas','VENDEDOR',1998-03-04,1250,1400,30); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> 
mysql> insert into empleado 
-> values(7698,'Blake Salas','AUXILIAR',2003-08-04,2850,150,30); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7782,'Clark Ken','AUXILIAR',2006-11-30,2450,1200,10); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado
-> values(7788,'Alma Scott','ANALISTA',2004-07-14,3000,0,20); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> 
mysql> insert into empleado 
-> values(7839,'Clara Lopez','PRESIDENTE',1998-11-11,5000,0,10); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7844,'Zoila Estrada','VENDEDOR',2007-10-03,1500,1300,30); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7876,'Diego Perez','SUPERVISOR',1999-11-03,1100,100,20); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> 
mysql> insert into empleado 
-> values(7900,'Ximena Rugeles','SUPERVISOR',2000-12-20,950,2500,30); 
Query OK, 1 row affected, 1 warning (0.01 sec) 
mysql> 
mysql> insert into empleado 
-> values(7902,'Viviana Morales','ANALISTA',2001-11-11,3000,1800,20); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> 
mysql> insert into empleado 
-> values(7934,'Tito Lopez','SUPERVISOR',2006-06-05,1300,0,10); 
Query OK, 1 row affected, 1 warning (0.02 sec) 
mysql> select * from empleado; 
+--------+-----------------+------------+------------+---------+----------+----- 
---------------+ 
| codigo | nombre | cargo | f_ingreso | salario | comision | depa 
rtamento_codep | 
+--------+-----------------+------------+------------+---------+----------+----- 
---------------+ 
| 7369 | Carlos Perdomo | SUPERVISOR | 0000-00-00 | 800 | 50 | 
20 | 
| 7499 | Fernando Velez | VENDEDOR | 0000-00-00 | 1600 | 300 | 
30 | 
| 7521 | Rosario Gomez | VENDEDOR | 0000-00-00 | 2975 | 200 | 
30 | 
| 7566 | Jones Wilson | AUXILIAR | 0000-00-00 | 2975 | 200 | 
20 | 
| 7654 | Martin Vanegas | VENDEDOR | 0000-00-00 | 1250 | 1400 | 
30 | 
| 7698 | Blake Salas | AUXILIAR | 0000-00-00 | 2850 | 150 | 
30 | 
| 7782 | Clark Ken | AUXILIAR | 0000-00-00 | 2450 | 1200 | 
10 | 
| 7788 | Alma Scott | ANALISTA | 0000-00-00 | 3000 | 0 | 
20 | 
| 7839 | Clara Lopez | PRESIDENTE | 0000-00-00 | 5000 | 0 | 
10 | 
| 7844 | Zoila Estrada | VENDEDOR | 0000-00-00 | 1500 | 1300 | 
30 | 
| 7876 | Diego Perez | SUPERVISOR | 0000-00-00 | 1100 | 100 | 
20 |
| 7900 | Ximena Rugeles | SUPERVISOR | 0000-00-00 | 950 | 2500 | 
30 | 
| 7902 | Viviana Morales | ANALISTA | 0000-00-00 | 3000 | 1800 | 
20 | 
| 7934 | Tito Lopez | SUPERVISOR | 0000-00-00 | 1300 | 0 | 
10 | 
+--------+-----------------+------------+------------+---------+----------+----- 
---------------+ 
14 rows in set (0.01 sec) 
mysql> select count(*) as 'NUMERO EMPLEADOS' from empleado; 
+------------------+ 
| NUMERO EMPLEADOS | 
+------------------+ 
| 14 | 
+------------------+ 
1 row in set (0.03 sec) 
mysql> select count(DISTINCT CARGO) as 'NUMEROS DE CARGOS' from empleado; 
+-------------------+ 
| NUMEROS DE CARGOS | 
+-------------------+ 
| 5 | 
+-------------------+ 
1 row in set (0.00 sec) 
mysql> select nombre_der as departamento, count(*) as 'NUMERO DE EMPLEADOS' from 
empleado, departamento where codep=deptno group by deptno; 
ERROR 1054 (42S22): Unknown column 'deptno' in 'where clause' 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> select nombre_der as departamento, count(*) as "NUMERO DE EMPLEADOS" from 
empleado, departamento where codep=departamento_codep group by departamento_cod 
ep; 
+---------------+---------------------+ 
| departamento | NUMERO DE EMPLEADOS | 
+---------------+---------------------+ 
| contabilidad | 3 | 
| investigacion | 5 | 
| ventas | 6 | 
+---------------+---------------------+ 
3 rows in set (0.03 sec) 
mysql> select cargo, count(*) as "empleados por cargo" from empleado group by ca 
rgo; 
+------------+---------------------+ 
| cargo | empleados por cargo | 
+------------+---------------------+ 
| ANALISTA | 2 | 
| AUXILIAR | 3 | 
| PRESIDENTE | 1 | 
| SUPERVISOR | 4 | 
| VENDEDOR | 4 | 
+------------+---------------------+ 
5 rows in set (0.00 sec) 
mysql> select nombre_der as departamento, sum(salario) as "suma salario" from em 
pleado,departamento where codep=departamento_codep group by departamento_codep; 
+---------------+--------------+ 
| departamento | suma salario | 
+---------------+--------------+ 
| contabilidad | 8750 |
| investigacion | 10875 | 
| ventas | 11125 | 
+---------------+--------------+ 
3 rows in set (0.02 sec) 
mysql> select departamento_codep from empleado group by departamento_codep havin 
g sum(salario) >9000; 
+--------------------+ 
| departamento_codep | 
+--------------------+ 
| 20 | 
| 30 | 
+--------------------+ 
2 rows in set (0.00 sec) 
mysql> select departamento_codep as CODIGO ,nombre_der as NOMBRE from empleado,d 
epartamento where codep=departamento_codep group by departamento_codep having su 
m(salario) >9000; 
+--------+---------------+ 
| CODIGO | NOMBRE | 
+--------+---------------+ 
| 20 | investigacion | 
| 30 | ventas | 
+--------+---------------+ 
2 rows in set (0.00 sec) 
mysql> select max(salario) as "salario mas alto" from empleado; 
+------------------+ 
| salario mas alto | 
+------------------+ 
| 5000 | 
+------------------+ 
1 row in set (0.00 sec) 
mysql> select nombre, salario from empleado where salario = (select max(salario) 
from empleado); 
+-------------+---------+ 
| nombre | salario | 
+-------------+---------+ 
| Clara Lopez | 5000 | 
+-------------+---------+ 
1 row in set (0.03 sec) 
mysql>
| investigacion | 10875 | 
| ventas | 11125 | 
+---------------+--------------+ 
3 rows in set (0.02 sec) 
mysql> select departamento_codep from empleado group by departamento_codep havin 
g sum(salario) >9000; 
+--------------------+ 
| departamento_codep | 
+--------------------+ 
| 20 | 
| 30 | 
+--------------------+ 
2 rows in set (0.00 sec) 
mysql> select departamento_codep as CODIGO ,nombre_der as NOMBRE from empleado,d 
epartamento where codep=departamento_codep group by departamento_codep having su 
m(salario) >9000; 
+--------+---------------+ 
| CODIGO | NOMBRE | 
+--------+---------------+ 
| 20 | investigacion | 
| 30 | ventas | 
+--------+---------------+ 
2 rows in set (0.00 sec) 
mysql> select max(salario) as "salario mas alto" from empleado; 
+------------------+ 
| salario mas alto | 
+------------------+ 
| 5000 | 
+------------------+ 
1 row in set (0.00 sec) 
mysql> select nombre, salario from empleado where salario = (select max(salario) 
from empleado); 
+-------------+---------+ 
| nombre | salario | 
+-------------+---------+ 
| Clara Lopez | 5000 | 
+-------------+---------+ 
1 row in set (0.03 sec) 
mysql>

More Related Content

Viewers also liked

Viewers also liked (10)

Reading comprehension
Reading comprehensionReading comprehension
Reading comprehension
 
A nation of invention
A nation of invention A nation of invention
A nation of invention
 
Speak aim high page16 work in pair
Speak aim high page16 work in pairSpeak aim high page16 work in pair
Speak aim high page16 work in pair
 
Orange computers group19
Orange computers group19Orange computers group19
Orange computers group19
 
Unit 12 using rubbish
Unit 12 using rubbishUnit 12 using rubbish
Unit 12 using rubbish
 
Exercise 1 countable and uncountable noun
Exercise 1 countable and uncountable nounExercise 1 countable and uncountable noun
Exercise 1 countable and uncountable noun
 
Slide 3 of each unit
Slide 3 of each unitSlide 3 of each unit
Slide 3 of each unit
 
Tenses table
Tenses tableTenses table
Tenses table
 
6ประโยชน์และคุณค่าขอป่างสาคู
6ประโยชน์และคุณค่าขอป่างสาคู6ประโยชน์และคุณค่าขอป่างสาคู
6ประโยชน์และคุณค่าขอป่างสาคู
 
Comparative & superlative
Comparative & superlativeComparative & superlative
Comparative & superlative
 

Similar to Empresa completo

Analytics functions in mysql, oracle and hive
Analytics functions in mysql, oracle and hiveAnalytics functions in mysql, oracle and hive
Analytics functions in mysql, oracle and hiveAnkit Beohar
 
Cat database
Cat databaseCat database
Cat databasetubbeles
 
Optimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsOptimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsI Goo Lee
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
MysqlfunctionsN13M
 
Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationRichard Crowley
 
MySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFMySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFRonald Bradford
 
My SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNMy SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNRonald Bradford
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesDamien Seguy
 
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfඅරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfAnilManage
 
Dublin 4x3-final-slideshare
Dublin 4x3-final-slideshareDublin 4x3-final-slideshare
Dublin 4x3-final-slideshareDag H. Wanvik
 
Short Intro to PHP and MySQL
Short Intro to PHP and MySQLShort Intro to PHP and MySQL
Short Intro to PHP and MySQLJussi Pohjolainen
 
Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Sergey Petrunya
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteRonald Bradford
 
Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatFranck Pachot
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql featuresConnor McDonald
 
Using Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query PerformanceUsing Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query Performanceoysteing
 

Similar to Empresa completo (20)

Mysql and html
Mysql and html Mysql and html
Mysql and html
 
Analytics functions in mysql, oracle and hive
Analytics functions in mysql, oracle and hiveAnalytics functions in mysql, oracle and hive
Analytics functions in mysql, oracle and hive
 
Cat database
Cat databaseCat database
Cat database
 
Optimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsOptimizing Queries Using Window Functions
Optimizing Queries Using Window Functions
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
Mysqlfunctions
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
Tugas praktikum smbd
Tugas praktikum smbdTugas praktikum smbd
Tugas praktikum smbd
 
Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System Presentation
 
MySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFMySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SF
 
Explain
ExplainExplain
Explain
 
My SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNMy SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTN
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queries
 
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfඅරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
 
Dublin 4x3-final-slideshare
Dublin 4x3-final-slideshareDublin 4x3-final-slideshare
Dublin 4x3-final-slideshare
 
Short Intro to PHP and MySQL
Short Intro to PHP and MySQLShort Intro to PHP and MySQL
Short Intro to PHP and MySQL
 
Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Window functions in MariaDB 10.2
Window functions in MariaDB 10.2
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That Bite
 
Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor format
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
 
Using Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query PerformanceUsing Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query Performance
 

Recently uploaded

Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...amitlee9823
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...amitlee9823
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxolyaivanovalion
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...amitlee9823
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 

Recently uploaded (20)

Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptx
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 

Empresa completo

  • 1. ---+--------------------+ | codigo | nombre | cargo | f_ingreso | salario | comision | cod_d ep | departamento_codep | +--------+----------------+------------+------------+---------+----------+------ ---+--------------------+ | 7369 | Carlos Perdomo | SUPERVISOR | 0000-00-00 | 800 | 50 | 20 | 10 | | 7499 | Fernando Velez | VENDEDOR | 0000-00-00 | 1600 | 300 | 30 | 20 | | 7521 | Rosario Gomez | VENDEDOR | 0000-00-00 | 2975 | 200 | 20 | 30 | +--------+----------------+------------+------------+---------+----------+------ ---+--------------------+ 3 rows in set (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | empresa | | mysql | +--------------------+ 3 rows in set (0.00 sec) mysql> drop database empresa; Query OK, 2 rows affected (0.10 sec) mysql> mysql> mysql> mysql> mysql> mysql> create database empresa; Query OK, 1 row affected (0.01 sec) mysql> use empresa; Database changed mysql> mysql> mysql> mysql> create table departamento -> (codep integer(30) PRIMARY KEY, -> nombre_der varchar(30), -> ubicacion varchar(30)); Query OK, 0 rows affected (0.05 sec) mysql> mysql> insert into departamento -> values(10,'contabilidad','cali'); Query OK, 1 row affected (0.02 sec) mysql> mysql> insert into departamento -> values(20,'investigacion','bogota'); Query OK, 1 row affected (0.02 sec) mysql> mysql> insert into departamento -> values(30,'ventas','manizales'); Query OK, 1 row affected (0.02 sec) mysql> select * from departamento; +-------+---------------+-----------+
  • 2. | codep | nombre_der | ubicacion | +-------+---------------+-----------+ | 10 | contabilidad | cali | | 20 | investigacion | bogota | | 30 | ventas | manizales | +-------+---------------+-----------+ 3 rows in set (0.00 sec) mysql> mysql> mysql> create table empleado -> (codigo integer, -> nombre varchar(30), -> cargo varchar(30), -> f_ingreso date, -> salario integer, -> comision integer, -> -> departamento_codep integer, -> PRIMARY KEY (codigo), -> FOREIGN KEY(departamento_codep) -> REFERENCES departamento(codep) -> ON DELETE NO ACTION -> ON UPDATE NO ACTION -> ); Query OK, 0 rows affected (0.06 sec) mysql> insert into empleado -> values(7369,'Carlos Perdomo','SUPERVISOR',1980-12-17,800,50,20); Query OK, 1 row affected, 1 warning (0.03 sec) mysql> mysql> insert into empleado -> values(7499,'Fernando Velez','VENDEDOR',1981-02-20,1600,300,30); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7521,'Rosario Gomez','VENDEDOR',1981-12-22,2975,200,30); Query OK, 1 row affected, 1 warning (0.01 sec) mysql> mysql> insert into empleado -> values(7566,'Jones Wilson','AUXILIAR',1981-04-21,2975,200,20); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7654,'Martin Vanegas','VENDEDOR',1998-03-04,1250,1400,30); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> mysql> insert into empleado -> values(7698,'Blake Salas','AUXILIAR',2003-08-04,2850,150,30); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7782,'Clark Ken','AUXILIAR',2006-11-30,2450,1200,10); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado
  • 3. -> values(7788,'Alma Scott','ANALISTA',2004-07-14,3000,0,20); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> mysql> insert into empleado -> values(7839,'Clara Lopez','PRESIDENTE',1998-11-11,5000,0,10); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7844,'Zoila Estrada','VENDEDOR',2007-10-03,1500,1300,30); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7876,'Diego Perez','SUPERVISOR',1999-11-03,1100,100,20); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> mysql> insert into empleado -> values(7900,'Ximena Rugeles','SUPERVISOR',2000-12-20,950,2500,30); Query OK, 1 row affected, 1 warning (0.01 sec) mysql> mysql> insert into empleado -> values(7902,'Viviana Morales','ANALISTA',2001-11-11,3000,1800,20); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> mysql> insert into empleado -> values(7934,'Tito Lopez','SUPERVISOR',2006-06-05,1300,0,10); Query OK, 1 row affected, 1 warning (0.02 sec) mysql> select * from empleado; +--------+-----------------+------------+------------+---------+----------+----- ---------------+ | codigo | nombre | cargo | f_ingreso | salario | comision | depa rtamento_codep | +--------+-----------------+------------+------------+---------+----------+----- ---------------+ | 7369 | Carlos Perdomo | SUPERVISOR | 0000-00-00 | 800 | 50 | 20 | | 7499 | Fernando Velez | VENDEDOR | 0000-00-00 | 1600 | 300 | 30 | | 7521 | Rosario Gomez | VENDEDOR | 0000-00-00 | 2975 | 200 | 30 | | 7566 | Jones Wilson | AUXILIAR | 0000-00-00 | 2975 | 200 | 20 | | 7654 | Martin Vanegas | VENDEDOR | 0000-00-00 | 1250 | 1400 | 30 | | 7698 | Blake Salas | AUXILIAR | 0000-00-00 | 2850 | 150 | 30 | | 7782 | Clark Ken | AUXILIAR | 0000-00-00 | 2450 | 1200 | 10 | | 7788 | Alma Scott | ANALISTA | 0000-00-00 | 3000 | 0 | 20 | | 7839 | Clara Lopez | PRESIDENTE | 0000-00-00 | 5000 | 0 | 10 | | 7844 | Zoila Estrada | VENDEDOR | 0000-00-00 | 1500 | 1300 | 30 | | 7876 | Diego Perez | SUPERVISOR | 0000-00-00 | 1100 | 100 | 20 |
  • 4. | 7900 | Ximena Rugeles | SUPERVISOR | 0000-00-00 | 950 | 2500 | 30 | | 7902 | Viviana Morales | ANALISTA | 0000-00-00 | 3000 | 1800 | 20 | | 7934 | Tito Lopez | SUPERVISOR | 0000-00-00 | 1300 | 0 | 10 | +--------+-----------------+------------+------------+---------+----------+----- ---------------+ 14 rows in set (0.01 sec) mysql> select count(*) as 'NUMERO EMPLEADOS' from empleado; +------------------+ | NUMERO EMPLEADOS | +------------------+ | 14 | +------------------+ 1 row in set (0.03 sec) mysql> select count(DISTINCT CARGO) as 'NUMEROS DE CARGOS' from empleado; +-------------------+ | NUMEROS DE CARGOS | +-------------------+ | 5 | +-------------------+ 1 row in set (0.00 sec) mysql> select nombre_der as departamento, count(*) as 'NUMERO DE EMPLEADOS' from empleado, departamento where codep=deptno group by deptno; ERROR 1054 (42S22): Unknown column 'deptno' in 'where clause' mysql> mysql> mysql> mysql> mysql> select nombre_der as departamento, count(*) as "NUMERO DE EMPLEADOS" from empleado, departamento where codep=departamento_codep group by departamento_cod ep; +---------------+---------------------+ | departamento | NUMERO DE EMPLEADOS | +---------------+---------------------+ | contabilidad | 3 | | investigacion | 5 | | ventas | 6 | +---------------+---------------------+ 3 rows in set (0.03 sec) mysql> select cargo, count(*) as "empleados por cargo" from empleado group by ca rgo; +------------+---------------------+ | cargo | empleados por cargo | +------------+---------------------+ | ANALISTA | 2 | | AUXILIAR | 3 | | PRESIDENTE | 1 | | SUPERVISOR | 4 | | VENDEDOR | 4 | +------------+---------------------+ 5 rows in set (0.00 sec) mysql> select nombre_der as departamento, sum(salario) as "suma salario" from em pleado,departamento where codep=departamento_codep group by departamento_codep; +---------------+--------------+ | departamento | suma salario | +---------------+--------------+ | contabilidad | 8750 |
  • 5. | investigacion | 10875 | | ventas | 11125 | +---------------+--------------+ 3 rows in set (0.02 sec) mysql> select departamento_codep from empleado group by departamento_codep havin g sum(salario) >9000; +--------------------+ | departamento_codep | +--------------------+ | 20 | | 30 | +--------------------+ 2 rows in set (0.00 sec) mysql> select departamento_codep as CODIGO ,nombre_der as NOMBRE from empleado,d epartamento where codep=departamento_codep group by departamento_codep having su m(salario) >9000; +--------+---------------+ | CODIGO | NOMBRE | +--------+---------------+ | 20 | investigacion | | 30 | ventas | +--------+---------------+ 2 rows in set (0.00 sec) mysql> select max(salario) as "salario mas alto" from empleado; +------------------+ | salario mas alto | +------------------+ | 5000 | +------------------+ 1 row in set (0.00 sec) mysql> select nombre, salario from empleado where salario = (select max(salario) from empleado); +-------------+---------+ | nombre | salario | +-------------+---------+ | Clara Lopez | 5000 | +-------------+---------+ 1 row in set (0.03 sec) mysql>
  • 6. | investigacion | 10875 | | ventas | 11125 | +---------------+--------------+ 3 rows in set (0.02 sec) mysql> select departamento_codep from empleado group by departamento_codep havin g sum(salario) >9000; +--------------------+ | departamento_codep | +--------------------+ | 20 | | 30 | +--------------------+ 2 rows in set (0.00 sec) mysql> select departamento_codep as CODIGO ,nombre_der as NOMBRE from empleado,d epartamento where codep=departamento_codep group by departamento_codep having su m(salario) >9000; +--------+---------------+ | CODIGO | NOMBRE | +--------+---------------+ | 20 | investigacion | | 30 | ventas | +--------+---------------+ 2 rows in set (0.00 sec) mysql> select max(salario) as "salario mas alto" from empleado; +------------------+ | salario mas alto | +------------------+ | 5000 | +------------------+ 1 row in set (0.00 sec) mysql> select nombre, salario from empleado where salario = (select max(salario) from empleado); +-------------+---------+ | nombre | salario | +-------------+---------+ | Clara Lopez | 5000 | +-------------+---------+ 1 row in set (0.03 sec) mysql>