This document contains the script for creating tables, inserting data, and providing exercises for a database class. It creates tables for categories, clients, functions, employees, orders, order items, and products. It then inserts sample data into these tables. The script is intended for students to run queries and exercises on this sample database.
When debugging the code, use Drop table statementsto drop pr.docxaryan532920
/* When debugging the code, use Drop table statements
to drop previously created tables.
When code is re-run, new tables will be created.
This allows easy debugging. */
Drop table dept cascade constraints;
Drop table emp cascade constraints;
Drop table customer cascade constraints;
Drop table product cascade constraints;
Drop table ord cascade constraints;
Drop table item cascade constraints;
Drop table salgrade cascade constraints;
Drop table bonus cascade constraints;
Drop table price cascade constraints;
Drop table dummy cascade constraints;
Purge RecycleBin;
CREATE TABLE DEPT (
DEPTNO NUMBER(2) NOT NULL,
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
CONSTRAINT DEPT_PRIMARY_KEY PRIMARY KEY (DEPTNO));
INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK');
INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');
INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4) CONSTRAINT EMP_MGR_FK REFERENCES EMP (EMPNO),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2) NOT NULL,
CONSTRAINT EMP_DEPTNO_FK FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO),
CONSTRAINT EMP_EMPNO_PK PRIMARY KEY (EMPNO));
INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,TO_DATE('17-NOV-2011','DD-MON-YYYY'),15000,NULL,10);
INSERT INTO EMP VALUES (7698,'Blake','MANAGER',7839,TO_DATE('1-MAY-2012','DD-MON-YYYY'),6850,NULL,30);
INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,TO_DATE('9-JUN-2013','DD-MON-YYYY'),5450,NULL,10);
INSERT INTO EMP VALUES (7566,'Jones','MANAGER',7839,TO_DATE('2-APR-2011','DD-MON-YYYY'),5975,NULL,20);
INSERT INTO EMP VALUES (7654,'Martin','SALESMAN',7698,TO_DATE('28-SEP-2012','DD-MON-YYYY'),4250,27400,30);
INSERT INTO EMP VALUES (7499,'ALLEN','SALESMAN',7698,TO_DATE('20-FEB-2013','DD-MON-YYYY'),3600,16300,30);
INSERT INTO EMP VALUES (7844,'TURNER','SALESMAN',7698,TO_DATE('8-SEP-2014','DD-MON-YYYY'),3500,0,30);
INSERT INTO EMP VALUES (7900,'James','CLERK',7698,TO_DATE('3-DEC-2015','DD-MON-YYYY'),4950,NULL,30);
INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698,TO_DATE('22-FEB-2016','DD-MON-YYYY'),3250,55500,30);
INSERT INTO EMP VALUES (7902,'ford','ANALYST',7566,TO_DATE('3-DEC-2016','DD-MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,TO_DATE('17-DEC-2015','DD-MON-YYYY'),3800,NULL,20);
INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,TO_DATE('09-DEC-2014','DD-MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,TO_DATE('12-JAN-2013','DD-MON-YYYY'),4100,NULL,20);
INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,TO_DATE('23-JAN-2016','DD-MON-YYYY'),4300,NULL,10);
CREATE TABLE BONUS (
ENAME VARCHAR2(10),
JOB ...
Starting from the database used in Project 1 (see the slightly cha.docxdessiechisomjj4
Starting from the database used in Project 1 (see the slightly changed schema from the original version used in P1, defined in the attached DDL file), a data warehouse star schema with the following characteristics will be defined:
· Dimension tables:
1. Date
2. Product
3. Customer
· Fact table:
1. Sales
For this final project, perform the following steps:
· Create the tables defined above in a star schema. Add the necessary columns in each table to facilitate the implementation of the queries defined below. Only the four tables listed above are allowed in that star schema
· Write PL/SQL code (anonymous blocks and/or subprograms) to populate the warehouse schema with data from the normalized database provided in the attached DDL script
· Write SQL code to perform the following queries:
1. What customer age group spent the most money in the last year? An age group is defined as a ten years interval, such as: 11 – 20, 21 – 30, etc
2. In what zip codes did the highest number of sales (number of items) occur during April 2015?
3. What day of the week did they do most business (by value of sales) in the last year?
4. What quarter is the worst (by value of sales) for each product category, using the whole set of historical data available in the warehouse?
5. What was the best sales month for each product in the last year?
· Write a couple of paragraphs describing:
. How this small data warehouse can help decision making
. How is it different from the original database used as data source
Submit the PL/SQL blocks and SQL statements as a text file (Notepad) following the document naming convention FirstLastFP.txt.
Grading: this project is awarded 100 points
15 points
DDL Script to create the tables in the star schema
25 points
PL/SQL code to populate the star schema from the original database
5 x 10 points
SQL statements for each of the requested queries
10 points
Description of how this data warehouse helps decision making and how it differs from regular databases
DROP TABLE ORDER_ITEMS;
DROP TABLE ORDERS;
DROP TABLE CUSTOMERS;
DROP TABLE PRODUCTS;
DROP TABLE CATEGORIES;
CREATE TABLE CATEGORIES (
ID NUMBER PRIMARY KEY,
Name VARCHAR2(20) NOT NULL);
CREATE TABLE PRODUCTS (
ID NUMBER PRIMARY KEY,
CatID NUMBER,
Name VARCHAR2(20) NOT NULL,
Price NUMBER NOT NULL,
FOREIGN KEY (CatID) REFERENCES CATEGORIES(ID));
CREATE TABLE CUSTOMERS (
ID NUMBER PRIMARY KEY,
Name VARCHAR2(50) NOT NULL,
DOB DATE NOT NULL,
Email VARCHAR2(50),
ZipCode CHAR(5) NOT NULL);
CREATE TABLE ORDERS (
ID NUMBER PRIMARY KEY,
CustID NUMBER NOT NULL,
DatePlaced DATE DEFAULT SYSDATE,
FOREIGN KEY (CustID) REFERENCES CUSTOMERS(ID));
CREATE TABLE ORDER_ITEMS (
OrderID NUMBER NOT NULL,
ProdID NUMBER NOT NULL,
Quantity NUMBER DEFAULT 1,
DateShipped DATE,
FOREIGN KEY (OrderID) REFERENCES ORDERS(ID),
FOREIGN KEY (ProdID) REFERENCES PRODUCTS(ID));
INSERT INTO CATEGORIES VALUES (1, 'Books');
INSERT INTO CATEGORIES VALUES (2, '.
On SQL Managment studioThis lab is all about database normalizatio.pdfinfomalad
On SQL Managment studio
This lab is all about database normalization. Download, from DocShare, and run Week 6
Normalizing.sql to create the four databases, UNF (Unnormalized Form), FNF (First Normal
Form), SNF (Second Normal Form), and TNF (Third Norma Form) used in this lab. Each of the
following will be executed against all four databases. This will require a use and go statement
between each query. All four queries should be able to run at one time. The goal of this lab is to
show how the different normalization change how data is queried. Note: The same result set will
be returned from each database. This is a good check to see that each query is correct.
Write a select statement that returns the project code, project name, and project manager.
List each Employee’s name, department, and department name.
List employee by project.
List each employee, project name, hourly rate, and department name.
the database is
Use master
GO
--
-- Unnormalized Database
--
CREATE DATABASE UNF;
GO
USE UNF;
GO
CREATE TABLE Unnormalized
(
ProjectCode varchar(100),
ProjectName varchar(100),
ProjectManager varchar(255),
ProjectBudget Decimal(10,2),
EmployeeNumber varchar(10),
EmployeeName varchar(100),
DepartmentNumber varchar(10),
DepartmentName varchar(100),
HourlyRate Decimal(10,2)
);
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S100\', \'John\', \'D03\',
\'Database\', 21.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S101\', \'George\',
\'D02\', \'Testing\', 16.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S102\', \'Bob\', \'D01\',
\'IT\', 22.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S103\', \'Jack\', \'D03\',
\'Database\', 18.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S104\', \'Jane\', \'D02\',
\'Testing\', 17.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S315\', \'Dave\', \'D01\', \'IT\',
23.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, Project.
Question 7 0 out of 1 points and unit costs As the marginal physical product of U.S. workers ,
the marginal cost of goods produced in the US, competitive in the global marketplace. - This
makes American goods Selected Answer: b. falls; falls; fall; more Answers: a rises; falls; fall;
less b. falls; falls; fall; more c. rises; falls; fall; more d, rises; falls; fall; more
Solution
As the marginal physical product of US workers RISES, the marginal cost of goods produced in
the US FALLS and unit costs FALL. This makes American goods More competitive in the
global market as they are cheaper than the rest. Hence will have larger market share.
Answer uis Part C.
When debugging the code, use Drop table statementsto drop pr.docxaryan532920
/* When debugging the code, use Drop table statements
to drop previously created tables.
When code is re-run, new tables will be created.
This allows easy debugging. */
Drop table dept cascade constraints;
Drop table emp cascade constraints;
Drop table customer cascade constraints;
Drop table product cascade constraints;
Drop table ord cascade constraints;
Drop table item cascade constraints;
Drop table salgrade cascade constraints;
Drop table bonus cascade constraints;
Drop table price cascade constraints;
Drop table dummy cascade constraints;
Purge RecycleBin;
CREATE TABLE DEPT (
DEPTNO NUMBER(2) NOT NULL,
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
CONSTRAINT DEPT_PRIMARY_KEY PRIMARY KEY (DEPTNO));
INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK');
INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');
INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4) CONSTRAINT EMP_MGR_FK REFERENCES EMP (EMPNO),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2) NOT NULL,
CONSTRAINT EMP_DEPTNO_FK FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO),
CONSTRAINT EMP_EMPNO_PK PRIMARY KEY (EMPNO));
INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,TO_DATE('17-NOV-2011','DD-MON-YYYY'),15000,NULL,10);
INSERT INTO EMP VALUES (7698,'Blake','MANAGER',7839,TO_DATE('1-MAY-2012','DD-MON-YYYY'),6850,NULL,30);
INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,TO_DATE('9-JUN-2013','DD-MON-YYYY'),5450,NULL,10);
INSERT INTO EMP VALUES (7566,'Jones','MANAGER',7839,TO_DATE('2-APR-2011','DD-MON-YYYY'),5975,NULL,20);
INSERT INTO EMP VALUES (7654,'Martin','SALESMAN',7698,TO_DATE('28-SEP-2012','DD-MON-YYYY'),4250,27400,30);
INSERT INTO EMP VALUES (7499,'ALLEN','SALESMAN',7698,TO_DATE('20-FEB-2013','DD-MON-YYYY'),3600,16300,30);
INSERT INTO EMP VALUES (7844,'TURNER','SALESMAN',7698,TO_DATE('8-SEP-2014','DD-MON-YYYY'),3500,0,30);
INSERT INTO EMP VALUES (7900,'James','CLERK',7698,TO_DATE('3-DEC-2015','DD-MON-YYYY'),4950,NULL,30);
INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698,TO_DATE('22-FEB-2016','DD-MON-YYYY'),3250,55500,30);
INSERT INTO EMP VALUES (7902,'ford','ANALYST',7566,TO_DATE('3-DEC-2016','DD-MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,TO_DATE('17-DEC-2015','DD-MON-YYYY'),3800,NULL,20);
INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,TO_DATE('09-DEC-2014','DD-MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,TO_DATE('12-JAN-2013','DD-MON-YYYY'),4100,NULL,20);
INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,TO_DATE('23-JAN-2016','DD-MON-YYYY'),4300,NULL,10);
CREATE TABLE BONUS (
ENAME VARCHAR2(10),
JOB ...
Starting from the database used in Project 1 (see the slightly cha.docxdessiechisomjj4
Starting from the database used in Project 1 (see the slightly changed schema from the original version used in P1, defined in the attached DDL file), a data warehouse star schema with the following characteristics will be defined:
· Dimension tables:
1. Date
2. Product
3. Customer
· Fact table:
1. Sales
For this final project, perform the following steps:
· Create the tables defined above in a star schema. Add the necessary columns in each table to facilitate the implementation of the queries defined below. Only the four tables listed above are allowed in that star schema
· Write PL/SQL code (anonymous blocks and/or subprograms) to populate the warehouse schema with data from the normalized database provided in the attached DDL script
· Write SQL code to perform the following queries:
1. What customer age group spent the most money in the last year? An age group is defined as a ten years interval, such as: 11 – 20, 21 – 30, etc
2. In what zip codes did the highest number of sales (number of items) occur during April 2015?
3. What day of the week did they do most business (by value of sales) in the last year?
4. What quarter is the worst (by value of sales) for each product category, using the whole set of historical data available in the warehouse?
5. What was the best sales month for each product in the last year?
· Write a couple of paragraphs describing:
. How this small data warehouse can help decision making
. How is it different from the original database used as data source
Submit the PL/SQL blocks and SQL statements as a text file (Notepad) following the document naming convention FirstLastFP.txt.
Grading: this project is awarded 100 points
15 points
DDL Script to create the tables in the star schema
25 points
PL/SQL code to populate the star schema from the original database
5 x 10 points
SQL statements for each of the requested queries
10 points
Description of how this data warehouse helps decision making and how it differs from regular databases
DROP TABLE ORDER_ITEMS;
DROP TABLE ORDERS;
DROP TABLE CUSTOMERS;
DROP TABLE PRODUCTS;
DROP TABLE CATEGORIES;
CREATE TABLE CATEGORIES (
ID NUMBER PRIMARY KEY,
Name VARCHAR2(20) NOT NULL);
CREATE TABLE PRODUCTS (
ID NUMBER PRIMARY KEY,
CatID NUMBER,
Name VARCHAR2(20) NOT NULL,
Price NUMBER NOT NULL,
FOREIGN KEY (CatID) REFERENCES CATEGORIES(ID));
CREATE TABLE CUSTOMERS (
ID NUMBER PRIMARY KEY,
Name VARCHAR2(50) NOT NULL,
DOB DATE NOT NULL,
Email VARCHAR2(50),
ZipCode CHAR(5) NOT NULL);
CREATE TABLE ORDERS (
ID NUMBER PRIMARY KEY,
CustID NUMBER NOT NULL,
DatePlaced DATE DEFAULT SYSDATE,
FOREIGN KEY (CustID) REFERENCES CUSTOMERS(ID));
CREATE TABLE ORDER_ITEMS (
OrderID NUMBER NOT NULL,
ProdID NUMBER NOT NULL,
Quantity NUMBER DEFAULT 1,
DateShipped DATE,
FOREIGN KEY (OrderID) REFERENCES ORDERS(ID),
FOREIGN KEY (ProdID) REFERENCES PRODUCTS(ID));
INSERT INTO CATEGORIES VALUES (1, 'Books');
INSERT INTO CATEGORIES VALUES (2, '.
On SQL Managment studioThis lab is all about database normalizatio.pdfinfomalad
On SQL Managment studio
This lab is all about database normalization. Download, from DocShare, and run Week 6
Normalizing.sql to create the four databases, UNF (Unnormalized Form), FNF (First Normal
Form), SNF (Second Normal Form), and TNF (Third Norma Form) used in this lab. Each of the
following will be executed against all four databases. This will require a use and go statement
between each query. All four queries should be able to run at one time. The goal of this lab is to
show how the different normalization change how data is queried. Note: The same result set will
be returned from each database. This is a good check to see that each query is correct.
Write a select statement that returns the project code, project name, and project manager.
List each Employee’s name, department, and department name.
List employee by project.
List each employee, project name, hourly rate, and department name.
the database is
Use master
GO
--
-- Unnormalized Database
--
CREATE DATABASE UNF;
GO
USE UNF;
GO
CREATE TABLE Unnormalized
(
ProjectCode varchar(100),
ProjectName varchar(100),
ProjectManager varchar(255),
ProjectBudget Decimal(10,2),
EmployeeNumber varchar(10),
EmployeeName varchar(100),
DepartmentNumber varchar(10),
DepartmentName varchar(100),
HourlyRate Decimal(10,2)
);
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S100\', \'John\', \'D03\',
\'Database\', 21.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S101\', \'George\',
\'D02\', \'Testing\', 16.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC010\', \'Reservation System\', \'Mr. Jones\', 120500.00, \'S102\', \'Bob\', \'D01\',
\'IT\', 22.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S103\', \'Jack\', \'D03\',
\'Database\', 18.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S104\', \'Jane\', \'D02\',
\'Testing\', 17.00)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeeNumber,
EmployeeName, DepartmentNumber, DepartmentName, HourlyRate)
VALUES (\'PC011\', \'HR System\', \'Mrs. Smith\', 500500.00, \'S315\', \'Dave\', \'D01\', \'IT\',
23.50)
INSERT INTO Unnormalized
(ProjectCode, ProjectName, ProjectManager, Project.
Question 7 0 out of 1 points and unit costs As the marginal physical product of U.S. workers ,
the marginal cost of goods produced in the US, competitive in the global marketplace. - This
makes American goods Selected Answer: b. falls; falls; fall; more Answers: a rises; falls; fall;
less b. falls; falls; fall; more c. rises; falls; fall; more d, rises; falls; fall; more
Solution
As the marginal physical product of US workers RISES, the marginal cost of goods produced in
the US FALLS and unit costs FALL. This makes American goods More competitive in the
global market as they are cheaper than the rest. Hence will have larger market share.
Answer uis Part C.
A task can be done in a very short way and in a very long way.
Which one will you choose?
Knowledge is Power!
This session gives lots of interesting knowledge about an allegedly boring topic - Constraints.
And this knowledge will give you the power to optimize and make better decisions.
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADataconomy Media
Making the data of a company accessible to analysts, business users and data scientists can be a quite painful endeavor. In the past 5 years, Project A has supported many of its portfolio companies with building data infrastructures and we experienced many of these pains first-hand. This talk shows how some of these pains can be overcome by applying common sense and standard software engineering best practices.
Use this script for the assignment.Please follow instructions as t.docxgarnerangelika
Use this script for the assignment.
Please follow instructions as to what to turn in.
USE MYSQL ONLY.
# orderentrydbScript.sql
# REV 3 Updated 05/15/2017 Added employee comm pct to employee name Theresa Beck
# Script to build the Order Entry Database
# Creates tables and inserts data for this assignment
# into an already open database.
#
# Drop database if exists for a clean copy
Drop database if exists orderentrydb;
# Assumes student has created a database and activated it.
# Create Database before you begin to populate data
Create Database orderentrydb;
Use orderentrydb;
# Remove tables if they already exist
# Useful if it's not your first time trying this script
DROP TABLE if exists ordline ;
Drop TABLE if exists OrderTBL ;
DROP TABLE if exists Customer ;
DROP TABLE if exists Employee ;
DROP TABLE if exists Product ;
# Create the Product Table
CREATE TABLE Product
( ProdNo CHAR(8),
ProdName VARCHAR(50) NOT NULL,
ProdMfg varchar(20) NOT NULL,
ProdQOH decimal(10,2),
ProdPrice DECIMAL(12,2),
ProdNextShipDate DATE,
PRIMARY KEY (ProdNo) );
# Put data into the Product Table
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P0036566','17 inch Color Monitor','ColorMeg, Inc.',12,'2007-02-20',169.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P0036577','19 inch Color Monitor','ColorMeg, Inc.',10,'2007-02-20',319.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1114590','R3000 Color Laser Printer','Connex',5,'2007-01-22',699.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1412138','10 Foot Printer Cable','Ethlite',100,null,12.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1445671','8-Outlet Surge Protector','Intersafe',33,null,14.99);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1556678','CVP Ink Jet Color Printer','Connex',8, '2007-01-22',99.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P3455443','Color Ink Jet Cartridge','Connex',24,'2007-01-22',38.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P6677900','Black Ink Jet Cartridge','Connex',44,null,25.69);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P9995676','Battery Back-up System','Cybercx',12,'2007-02-01',89.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P4200344','36-Bit Color Scanner','UV Components',16,'2007-01-29',199.99);
# Create the Employee Table
CREATE TABLE Employee
( EmpNo varCHAR(8),
EmpFirstName varchar(20) NOT NULL,
EmpLastName varchar(30) NOT NULL,
EmpPhone varCHAR(15),
EmpEMail ...
Running Intelligent Applications inside a Database: Deep Learning with Python...Miguel González-Fierro
In this talk we present a new paradigm of computation where the intelligence is computed inside the database. Standard software systems must get the data from the database to execute a routine. If the size of the data is big, there are inefficiencies due to the data movement. Store procedures tried to solve this issue in the past, allowing for computing simple functions inside the database. However, only simple routines can be executed.
To showcase the capabilities of our new system, we created a lung cancer detection algorithm using Microsoft’s Cognitive Toolkit, also known as CNTK. We used transfer learning between ImageNet dataset, which contains natural images, and a lung cancer dataset, which contains scans of horizontal sections of the lung for healthy and sick patients. Specifically, a pretrained Convolutional Neural Network on ImageNet is used on the lung cancer dataset to generate features. Once the features are computed, a boosted tree is applied to predict whether the patient has cancer or not.
All this process is computed inside the database, so the data movement is minimized. We are even able to execute the algorithm using the GPU of the virtual machine that hosts the database. Using a GPU, we can compute the featurization in less than 1h, in contrast to using a CPU, that would take up to 32h. Finally, we set up an API to connect the solution to a web app, where a doctor can analyze the images and get a prediction of a patient.
A task can be done in a very short way and in a very long way.
Which one will you choose?
Knowledge is Power!
This session gives lots of interesting knowledge about an allegedly boring topic - Constraints.
And this knowledge will give you the power to optimize and make better decisions.
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADataconomy Media
Making the data of a company accessible to analysts, business users and data scientists can be a quite painful endeavor. In the past 5 years, Project A has supported many of its portfolio companies with building data infrastructures and we experienced many of these pains first-hand. This talk shows how some of these pains can be overcome by applying common sense and standard software engineering best practices.
Use this script for the assignment.Please follow instructions as t.docxgarnerangelika
Use this script for the assignment.
Please follow instructions as to what to turn in.
USE MYSQL ONLY.
# orderentrydbScript.sql
# REV 3 Updated 05/15/2017 Added employee comm pct to employee name Theresa Beck
# Script to build the Order Entry Database
# Creates tables and inserts data for this assignment
# into an already open database.
#
# Drop database if exists for a clean copy
Drop database if exists orderentrydb;
# Assumes student has created a database and activated it.
# Create Database before you begin to populate data
Create Database orderentrydb;
Use orderentrydb;
# Remove tables if they already exist
# Useful if it's not your first time trying this script
DROP TABLE if exists ordline ;
Drop TABLE if exists OrderTBL ;
DROP TABLE if exists Customer ;
DROP TABLE if exists Employee ;
DROP TABLE if exists Product ;
# Create the Product Table
CREATE TABLE Product
( ProdNo CHAR(8),
ProdName VARCHAR(50) NOT NULL,
ProdMfg varchar(20) NOT NULL,
ProdQOH decimal(10,2),
ProdPrice DECIMAL(12,2),
ProdNextShipDate DATE,
PRIMARY KEY (ProdNo) );
# Put data into the Product Table
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P0036566','17 inch Color Monitor','ColorMeg, Inc.',12,'2007-02-20',169.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P0036577','19 inch Color Monitor','ColorMeg, Inc.',10,'2007-02-20',319.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1114590','R3000 Color Laser Printer','Connex',5,'2007-01-22',699.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1412138','10 Foot Printer Cable','Ethlite',100,null,12.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1445671','8-Outlet Surge Protector','Intersafe',33,null,14.99);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P1556678','CVP Ink Jet Color Printer','Connex',8, '2007-01-22',99.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P3455443','Color Ink Jet Cartridge','Connex',24,'2007-01-22',38.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P6677900','Black Ink Jet Cartridge','Connex',44,null,25.69);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P9995676','Battery Back-up System','Cybercx',12,'2007-02-01',89.00);
INSERT INTO product
(ProdNo, ProdName, ProdMfg, ProdQOH, ProdNextShipDate, ProdPrice)
VALUES ('P4200344','36-Bit Color Scanner','UV Components',16,'2007-01-29',199.99);
# Create the Employee Table
CREATE TABLE Employee
( EmpNo varCHAR(8),
EmpFirstName varchar(20) NOT NULL,
EmpLastName varchar(30) NOT NULL,
EmpPhone varCHAR(15),
EmpEMail ...
Running Intelligent Applications inside a Database: Deep Learning with Python...Miguel González-Fierro
In this talk we present a new paradigm of computation where the intelligence is computed inside the database. Standard software systems must get the data from the database to execute a routine. If the size of the data is big, there are inefficiencies due to the data movement. Store procedures tried to solve this issue in the past, allowing for computing simple functions inside the database. However, only simple routines can be executed.
To showcase the capabilities of our new system, we created a lung cancer detection algorithm using Microsoft’s Cognitive Toolkit, also known as CNTK. We used transfer learning between ImageNet dataset, which contains natural images, and a lung cancer dataset, which contains scans of horizontal sections of the lung for healthy and sick patients. Specifically, a pretrained Convolutional Neural Network on ImageNet is used on the lung cancer dataset to generate features. Once the features are computed, a boosted tree is applied to predict whether the patient has cancer or not.
All this process is computed inside the database, so the data movement is minimized. We are even able to execute the algorithm using the GPU of the virtual machine that hosts the database. Using a GPU, we can compute the featurization in less than 1h, in contrast to using a CPU, that would take up to 32h. Finally, we set up an API to connect the solution to a web app, where a doctor can analyze the images and get a prediction of a patient.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
1. DISCIPLINA: BANCO DE DADOS I
TÍTULO DA AULA: COMANDO SELECT (DQL) – PARTE 2
Aula 13
Rev. 0
31.10.2019
Pág. 1 de 4
CENTRO UNIVERSITÁRIO PADRE ANCHIETA – PROF. RODRIGO SAITO - rodrigok@anchieta.br
Exercícios
1. Utilize o script abaixo para fazer os exercícios a seguir:
Figura 01 – Diagrama do script para exercícios
OBSERVAÇÃO: AO COPIAR E COLAR, AS LINHAS COM QUEBRAS DEVEM SER
UNIFICADAS;
use master;
go
create database SI_BDI_A12;
go
use SI_BDI_A12;
go
CREATE TABLE CATEGORIA (
CODIGO_CATEG int NOT NULL,
DESCRICAO_CATEG varchar(30) NULL
)
go
CREATE TABLE CLIENTE (
CODIGO_CLI integer NOT NULL,
RAZAO_SOCIAL varchar(50) NULL,
CNPJ_CLI char(18) NULL,
IE_CLI char(15) NULL,
ENDERECO_CLI varchar(50) NULL,
BAIRRO_CLI varchar(30) NULL,
CIDADE_CLI varchar(30) NULL,
UF_CLI char(02) NULL,
CEP_CLI char(11) NULL
2. DISCIPLINA: BANCO DE DADOS I
TÍTULO DA AULA: COMANDO SELECT (DQL) – PARTE 2
Aula 13
Rev. 0
31.10.2019
Pág. 2 de 4
CENTRO UNIVERSITÁRIO PADRE ANCHIETA – PROF. RODRIGO SAITO - rodrigok@anchieta.br
)
go
CREATE TABLE FUNCAO (
CODIGO_FUNCAO int NOT NULL,
DESCRICAO_FUNCAO varchar(30) NULL
)
go
CREATE TABLE FUNCIONARIO (
CODIGO_FUNC int NOT NULL,
NOME_FUNC varchar(50) NULL,
ENDERECO_FUNC varchar(50) NULL,
BAIRRO_FUNC varchar(30) NULL,
CIDADE_FUNC varchar(30) NULL,
UF_FUNC char(02) NULL,
CEP_FUNC char(11) NULL,
DATA_ADMISSAO_FUNC datetime NULL,
DATA_DEMISSAO_FUNC datetime NULL,
CODIGO_FUNCAO int NULL
)
go
CREATE TABLE ITENS_PEDIDO (
NUMERO_PED int NOT NULL,
ITEM_PED int NOT NULL,
CODIGO_PROD int NULL,
QUANTIDADE int NULL
)
go
CREATE TABLE PEDIDOS (
NUMERO_PED int NOT NULL,
DATA_PED datetime NULL,
CODIGO_FUNC int NULL,
CODIGO_CLI integer NULL
)
go
CREATE TABLE PRODUTO (
CODIGO_PROD int NOT NULL,
DESCRICAO_PROD varchar(30) NULL,
UNIDADE_PROD char(02) NULL,
VALOR_CUSTO numeric(10,2) NULL,
CODIGO_CATEG int NULL,
ESTOQUE_INI int NULL,
ESTOQUE_MIN int NULL,
ESTOQUE_MAX int NULL
)
go
INSERT INTO DBO.CATEGORIA (CODIGO_CATEG, DESCRICAO_CATEG) VALUES (1,'ALIMENTOS BASICOS');
INSERT INTO DBO.CATEGORIA (CODIGO_CATEG, DESCRICAO_CATEG) VALUES (2,'ALIMENTOS SECUNDARIOS');
INSERT INTO DBO.CATEGORIA (CODIGO_CATEG, DESCRICAO_CATEG) VALUES (3,'FRUTAS');
INSERT INTO DBO.CATEGORIA (CODIGO_CATEG, DESCRICAO_CATEG) VALUES (4,'LEGUMES');
INSERT INTO DBO.FUNCAO (CODIGO_FUNCAO, DESCRICAO_FUNCAO) VALUES (1,'GERENTE COMERCIAL');
INSERT INTO DBO.FUNCAO (CODIGO_FUNCAO, DESCRICAO_FUNCAO) VALUES (2,'VENDEDOR(A)');
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(001,'ARROZ', 'KG',3.20,1,025,050,500);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(002,'FEIJAO', 'KG',4.50,1,025,050,400);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(003,'MACARRAO', 'UN',3.70,1,050,100,800);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(004,'SARDINHA', 'UN',5.35,1,100,200,1000);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(005,'BOLACHA DE AGUA E SAL', 'UN',1.20,2,025,050,250);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(006,'MARGARINA', 'UN',3.40,2,100,100,200);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(007,'BOLO DE CAIXINHA', 'GR',5.60,2,050,100,300);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(008,'MACA', 'KG',5.60,3,200,500,1000);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(009,'BANANA', 'KG',3.25,3,250,500,1000);
3. DISCIPLINA: BANCO DE DADOS I
TÍTULO DA AULA: COMANDO SELECT (DQL) – PARTE 2
Aula 13
Rev. 0
31.10.2019
Pág. 3 de 4
CENTRO UNIVERSITÁRIO PADRE ANCHIETA – PROF. RODRIGO SAITO - rodrigok@anchieta.br
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(010,'PERA', 'KG',6.10,3,200,200,500);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(011,'KIWI', 'KG',8.30,3,300,300,750);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(012,'BATATA', 'KG',3.80,4,300,100,300);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(013,'CENOURA', 'KG',4.60,4,200,200,300);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(014,'ERVILHA', 'LT',6.25,4,050,100,300);
INSERT INTO DBO.PRODUTO (CODIGO_PROD, DESCRICAO_PROD, UNIDADE_PROD, VALOR_CUSTO, CODIGO_CATEG, ESTOQUE_INI, ESTOQUE_MIN, ESTOQUE_MAX) VALUES
(015,'TOMATE', 'KG',2.10,4,100,200,500);
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (01,'COMPRA TUDO
LTDA', '11.111.111/0001-11','111.111.111.111','RUA DO RECANDO BRANCO, 111', 'PARQUE SANTO ANTONIO','JUNDIAI', 'SP','13.258-999');
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (02,'VAREJAO DE
OFERTAS E CIA', '22.222.222/0002-22','222.222.222.222','AV. CINCO DE ABRIL, 222', 'CENTRO', 'JUNDIAI', 'SP','13.587-965');
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (03,'CONQUISTA
SUPERMECADOS', '33.333.333/0003-33','333.333.333.333','RUA CINCERO QUIRINO JR, 454','BAIRRO DO PONTO', 'SAO PAULO', 'SP','05.333-333');
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (04,'DEMIS
MERCEARIA', '44.444.444/0004-44','444.444.444.444','RUA QUINZE DE NOVEMBRO, 432','BAIRRO DOS CARAMUJOS','SAO PAULO', 'SP','05.444-444');
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (05,'NICOLAS & CIA
LTDA', '55.555.555/0005-55','555.555.555.555','RUA TAUNAI PAULO FRANCO, 32','BAIRRO DO RETIRO', 'SAO CAETANO', 'SP','13.666-666');
INSERT INTO CLIENTE (CODIGO_CLI, RAZAO_SOCIAL, CNPJ_CLI, IE_CLI, ENDERECO_CLI, BAIRRO_CLI, CIDADE_CLI, UF_CLI, CEP_CLI) VALUES (06,'OVERDOSE
ALIMENTOS', '66.666.666/0006-66','666.666.666.666','RUA FRANCISCO MORATO, 434', 'JARDIM PAULISTA', 'JUNDIAI', 'SP','13.667-777');
INSERT INTO FUNCIONARIO (CODIGO_FUNC, NOME_FUNC, ENDERECO_FUNC, BAIRRO_FUNC, CIDADE_FUNC, UF_FUNC, CEP_FUNC, DATA_ADMISSAO_FUNC, CODIGO_FUNCAO)
VALUES (01,'TATIANA SILVA', 'RUA CINCO DE FEVEREIRO, 212', 'CENTRO', 'JUNDIAI', 'SP', '13.587-878','01/03/2000',1);
INSERT INTO FUNCIONARIO (CODIGO_FUNC, NOME_FUNC, ENDERECO_FUNC, BAIRRO_FUNC, CIDADE_FUNC, UF_FUNC, CEP_FUNC, DATA_ADMISSAO_FUNC, CODIGO_FUNCAO)
VALUES (02,'RONALDO BARBOSA', 'RUA GAMOES SOUTO, 323', 'JARDIM AMERICA', 'JUNDIAI', 'SP', '13.587-585','01/06/2003',2);
INSERT INTO FUNCIONARIO (CODIGO_FUNC, NOME_FUNC, ENDERECO_FUNC, BAIRRO_FUNC, CIDADE_FUNC, UF_FUNC, CEP_FUNC, DATA_ADMISSAO_FUNC, CODIGO_FUNCAO)
VALUES (03,'VANESSA SIQUEIRA','RUA DA LIBERDADE, 343', 'LIBERDADE', 'SAO PAULO', 'SP', '05.322-222','01/03/2004',2);
INSERT INTO FUNCIONARIO (CODIGO_FUNC, NOME_FUNC, ENDERECO_FUNC, BAIRRO_FUNC, CIDADE_FUNC, UF_FUNC, CEP_FUNC, DATA_ADMISSAO_FUNC, CODIGO_FUNCAO)
VALUES (04,'MARIANA SILVA', 'RUA TORRES NEVES, 543', 'JARDIM DO PORTO', 'JUNDIAI', 'SP', '13.533-531','01/02/2005',2);
INSERT INTO FUNCIONARIO (CODIGO_FUNC, NOME_FUNC, ENDERECO_FUNC, BAIRRO_FUNC, CIDADE_FUNC, UF_FUNC, CEP_FUNC, DATA_ADMISSAO_FUNC, CODIGO_FUNCAO)
VALUES (05,'TALLES NARCISO', 'AV. FREDERICO OZANAN, 433', 'JARDIM TIRADENTES', 'JUNDIAI', 'SP', '13.534-365','01/04/2005',2);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (001,'01/05/2005',01,01);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (002,'01/16/2005',01,02);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (003,'01/18/2005',01,03);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (100,'01/06/2003',02,01);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (101,'02/06/2003',02,02);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (102,'03/06/2003',02,03);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (200,'01/06/2005',03,04);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (201,'08/10/2004',03,05);
INSERT INTO PEDIDOS (NUMERO_PED, DATA_PED, CODIGO_FUNC, CODIGO_CLI) VALUES (202,'03/05/2006',03,01);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (001,01,001,010);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (001,02,002,020);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (001,03,005,030);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (002,01,004,050);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (002,02,007,010);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (002,03,008,010);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (002,04,002,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (003,01,009,200);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (003,02,010,010);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (003,03,014,200);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (003,04,015,500);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (100,01,001,200);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (100,02,004,250);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (100,03,006,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (100,04,010,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (101,01,011,250);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (101,02,012,200);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (101,03,013,300);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (102,01,001,200);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (102,02,002,250);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (102,03,003,400);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (200,01,003,300);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (200,02,008,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (200,03,009,400);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (201,01,001,300);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (201,02,002,300);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (201,03,003,400);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (201,05,005,600);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,01,006,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,02,007,185);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,03,008,320);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,04,009,100);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,05,010,150);
INSERT INTO ITENS_PEDIDO (NUMERO_PED, ITEM_PED, CODIGO_PROD, QUANTIDADE) VALUES (202,06,011,190);
Script de criação do banco de dados, tabelas e dados
4. DISCIPLINA: BANCO DE DADOS I
TÍTULO DA AULA: COMANDO SELECT (DQL) – PARTE 2
Aula 13
Rev. 0
31.10.2019
Pág. 4 de 4
CENTRO UNIVERSITÁRIO PADRE ANCHIETA – PROF. RODRIGO SAITO - rodrigok@anchieta.br
2. Resolva as questões abaixo:
a. Faça uma SQL que mostre a descrição da categoria e quantidade de produtos que a mesma
possui;
b. Faça uma SQL que mostre a descrição da categoria e o valor total dos produtos que a
mesma possui; (OMENTE VALOR DA CATEGORIA E NÃO
CONSIDERAR VALOR DOS PEDIDOS FEITOS);
c. Faça uma SQL que mostre os produtos cuja a descrição da categoria seja "LIMPEZA";
d. Selecione o nome dos funcionários com sua devida quantidade de pedidos atendidos no
período do ano de 2003.
e. Selecione a cidade (nome) e a quantidade de pedidos feitos por cidade, ordenados pela
quantidade de pedidos.
f. Selecione os funcionários que possuem a quantidade de pedidos menores que 10, em ordem
da quantidade.
g. Selecione a descrição do produto e a quantidade de pedidos desses produtos, ordenados
pela quantidade;
h. Mostre os dados dos pedidos, com seus devidos totais do pedidos;
i. Selecione a razão social do cliente com seus devidos valores de pedidos;
j. Selecione o valor dos pedidos de funcionários demitidos;