Task - Stored Procedures - classicmodels DB #10
Replies: 51 comments
-
delimiter //
mysql> create procedure getemployees()
-> begin
-> select concat(firstname,' ',lastname),city,state,country from employees inner join offices using (officecode);
-> end
-> //
delimiter ;
mysql> call getemployees();
delimiter //
mysql> create procedure getpayments()
-> begin
-> select customername,checknumber,paymentdate,amount from customers inner join payments using (customernumber);
-> end
-> //
delimiter ;
mysql> call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
delimiter //
create procedure getAllEmployees()
begin
select concat(firstName," ",lastName) as fullName,city,state,country from employees,offices where employees.officeCode = offices.officeCode;
end//
delimiter ;
delimiter //
create procedure getPayments()
begin
select customerName,checkNumber,paymentDate,amount from customers,payments where customers.customerNumber=payments.customerNumber;
end//
delimiter ; |
Beta Was this translation helpful? Give feedback.
-
delimiter //
create procedure getAllEmployees() begin select concat(e.firstName, " ", e.lastName), o.city, o.state, o.country from employees e, offices o where e.officeCode = o.officeCode; end //
delimiter ;
call getAllEmployees();
delimiter //
create procedure getpayments() begin select customername,checknumber,paymentdate,amount from customers inner join payments using (customernumber); end //
delimiter ;
call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
DELIMITER //
CREATE PROCEDURE get_employees()
BEGIN
select concat(firstname,' ',lastname),city,state,country from employees inner join offices using (officecode);
END
//
DELIMITER ;
call get_employees();
DELIMITER //
CREATE PROCEDURE getpayments()
BEGIN
select customername,checknumber,paymentdate,amount from customers inner join payments using (customernumber);
END
//
DELIMITER ;
call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
delimiter //
create procedure getAllEmployees()
begin
select
concat(e.firstname, ' ', e.lastname),
o.city,
o.state,
o.country
from
employees e
inner join offices o using(officecode);
end //
delimiter;
call getAllEmployees();
delimiter //
create procedure getpayments() begin
select
customername,
checknumber,
paymentdate,
amount
from
customers
inner join payments using (customernumber);
end //
delimiter;
call getpayments() |
Beta Was this translation helpful? Give feedback.
-
DELIMITER $$
CREATE PROCEDURE getAllEmployees()
BEGIN
select concat(firstName," ",lastName) as fullName, o.city, o.state, o.country from employees e inner join offices o using (officeCode);
END $$
DELIMITER ;
DELIMITER &&
CREATE PROCEDURE getPayments()
BEGIN
select customerName, p.checkNumber, p.paymentDate, p.amount from customers inner join payments p using (customerNumber);
END &&
DELIMITER ;
CALL getPayments();
CALL getAllEmployees(); |
Beta Was this translation helpful? Give feedback.
-
|
DELIMITER // DELIMITER // |
Beta Was this translation helpful? Give feedback.
-
|
DELIMITER // call get_employees(); DELIMITER // call getpayments();`` |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
DELIMITER $$
CREATE PROCEDURE getAllEmployes()
BEGIN
SELECT concat(firstname,' ',lastname) as fullName,city,state,country from employees inner join offices using (officecode);
END $$
DELIMITER ;
CALL getAllEmployes();
DELIMITER $$
CREATE PROCEDURE getpayments()
BEGIN
SELECT customername,checknumber,paymentdate,amount from customers inner join payments using (customernumber);
END $$
DELIMITER ;
Call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
DELIMITER @@
CREATE Procedure getModAllEmployee()
BEGIN
SELECT concat(firstName," ",lastName) as fullName, city,state,country from employees INNER JOIN offices USING(officeCode) LIMIT 10;
END @@
DELIMITER ;
CALL getModAllEmployee()
DELIMITER @@
CREATE Procedure getPayments()
BEGIN
Select customerName,checkNumber,paymentDate,amount from customers INNER join payments using(customerNumber);
END @@
DELIMITER ;
CALL getPayments() |
Beta Was this translation helpful? Give feedback.
-
|
```EMPLOYEES PROCEDURE |
Beta Was this translation helpful? Give feedback.
-
1. DELIMITER $$
CREATE PROCEDURE getAllEmployees()
BEGIN
SELECT concat(firstName," ",lastName) as fullname,city,state,country FROM employees
inner join offices using(officeCode);
END $$
DELIMITER ;
CALL getAllEmployees();
2. DELIMITER $$
CREATE PROCEDURE getPayments()
BEGIN
SELECT customername,checknumber,paymentdate,amount from customers inner join payments using (customernumber);
END $$
DELIMITER ;
CALL getPayments();
|
Beta Was this translation helpful? Give feedback.
-
|
CREATE PROCEDURE getAllEmployees()
BEGIN
SELECT concat(e.firstName," ",e.lastName),o.city,o.state,o.country
FROM employees e INNER JOIN offices o USING(officeCode);
END //
CREATE PROCEDURE getPayments()
BEGIN
SELECT c.customerName,p.checkNumber,p.paymentDate,p.amount
FROM customers c INNER JOIN payments p USING(customerNumber);
END //
|
Beta Was this translation helpful? Give feedback.
-
DELIMITER//
CREATE PROCEDURE getEmployees()
BEGIN
SELECT CONCAT(firstName," ",lastName) AS fullName,city,state,country
FROM employees e INNER JOIN offices o USING (officeCode);
END//
DELIMITER ;
CALL getEmployees();
SHOW PROCEDURE STATUS LIKE 'getEmployees';
DELIMITER //
CREATE PROCEDURE getpayments()
BEGIN
SELECT customername,checknumber,paymentdate,amount FROM customers INNER JOIN payments USING (customernumber);
END //
DELIMITER ;
call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
--Q1
DELIMITER //
CREATE PROCEDURE getEmployees()
BEGIN
select concat(firstname, ' ', lastname),
city,
country
from employees
inner join offices using (officecode);
END //
DELIMITER ;
call getEmployees();
--Q2
DELIMITER //
CREATE PROCEDURE getPayments()
BEGIN
select customerName,
checkNumber,
paymentDate,
amount
from customers
inner join payments using (customerNumber);
END //
DELIMITER;
call getPayments(); |
Beta Was this translation helpful? Give feedback.
-
--1.
DELIMITER / /
CREATE PROCEDURE getEmployees()
BEGIN
select concat(firstname, ' ', lastname),
city,
state,
country
from employees
inner join offices using (officecode);
END
/ / DELIMITER;
CALL getEmployees();
--2.
DELIMITER / / CREATE PROCEDURE getPayments() BEGIN
SELECT c.customerName,
p.checkNumber,
p.paymentDate,
p.amount
from payments p,
customers c
where c.customerNumber = p.customerNumber;
END
/ / DELIMITER;
CALL getPayments(); |
Beta Was this translation helpful? Give feedback.
-
DELIMITER //
create procedure getEmployees2(IN empNumber INT)
BEGIN
select lastName, firstName, city, state, country from employees INNER JOIN offices using(officeCode) where employeeNumber=empNumber;
END //
DELIMITER ;
CALL getEmployees2(1002);
DELIMITER //
create Procedure getPaymentDetails2(IN customerN INT)
BEGIN
select customerName, checkNumber, paymentDate, amount from customers inner join payments using(customerNumber) where customerNumber=customerN;
END //
delimiter ;
CALL `getPaymentDetails2`(103); |
Beta Was this translation helpful? Give feedback.
-
delimiter//
create procedure getemployees( )
BEGIN
select CONCAT(firstName," ",lastname) as names, city, state, country from employees inner join offices using(officeCode);
end//
delimiter;
call getemployees();
drop PROCEDURE getemployees;
-- .........................................................................................
delimiter//
Create procedure getpayments( )
BEGIN
select customerName, checkNumber, paymentDate, amount from customers inner join payments using(customerNumber);
end//
delimiter;
call getpayments(); |
Beta Was this translation helpful? Give feedback.
-
1. Create a stored procedure named getEmployees() to display the following employee and their office info: name, city, state, and country.Solution 2. Create a stored procedure named getPayments() that prints the following customer and payment info:customerName, checkNumber, paymentDate, and amount.Solution |
Beta Was this translation helpful? Give feedback.
-
|
1.Create a stored procedure named getEmployees() to display the following employee and their office info: name, city, state, and country. 2.Create a stored procedure named getPayments() that prints the following customer and payment info:customerName, checkNumber, paymentDate, and amount. |
Beta Was this translation helpful? Give feedback.
-
-- Discussion Forum 10
delimiter $$
create procedure getEmployees(
in id int
)
begin
select concat(firstName, ' ', lastName) as Name, city, state, country from employees e
join offices o using (officeCode)
where e.employeeNumber = id;
end $$
delimiter ;
call getEmployees(1002); |
Beta Was this translation helpful? Give feedback.
-
|
--1. Create a stored procedure named getEmployees() to display the following employee and their office info: name, city, state, and country. delimiter // create procedure getEmployees() end // delimiter ; call getEmployees(); --2. Create a stored procedure named getPayments() that prints the following customer and payment info:customerName, checkNumber, paymentDate, and amount. delimiter // create procedure getPayments() end // delimiter ; call getPayments(); |
Beta Was this translation helpful? Give feedback.
-
|
drop procedure getEmployees; call getEmployees(); -- Q2 call getPayments(); |
Beta Was this translation helpful? Give feedback.
-
|
-- 1. Create a stored procedure named getEmployees() to display the following employee and their office info: name, city, state, and country. USE classicmodels; DELIMITER $$ CALL getEmployees(); SHOW CREATE PROCEDURE getEmployees; SHOW PROCEDURE STATUS LIKE 'getEmployees'; -- 2. Create a stored procedure named getPayments() that prints the following customer and payment info:customerName, checkNumber, paymentDate, and amount. DELIMITER $$ CALL getPayments() |
Beta Was this translation helpful? Give feedback.
-
|
--1 --2 |
Beta Was this translation helpful? Give feedback.
-
|
#1 DELIMITER ; #2 DELIMITER ; |
Beta Was this translation helpful? Give feedback.
-
-- 1. Create a stored procedure named getEmployees() to display the following
-- employee and their office info: name, city, state, and country.
delimiter //
create procedure getEmployees()
begin
select
concat(e.firstName, ' ', e.lastName) as name, o.city, o.state, o.country
from employees e join offices o using (officeCode);
end //
delimiter ;
call getEmployees();
drop procedure getEmployees;
-- 2. Create a stored procedure named getPayments() that prints the following
-- customer and payment info:customerName, checkNumber, paymentDate, and amount.
delimiter //
create procedure getPayments()
begin
select customerName, checkNumber, paymentDate, amount
from payments
join customers using (customerNumber);
end //
delimiter ;
call getPayments();
drop procedure getPayments; |
Beta Was this translation helpful? Give feedback.
-
DELIMITER $$
DELIMITER %% |
Beta Was this translation helpful? Give feedback.
-
|
#1.Create a stored procedure named getEmployees() to display the following employee and their office info: name, city, state, and country. CREATE PROCEDURE getEmployees(IN emp_name VARCHAR(255)) #2.Create a stored procedure named getPayments() that prints the following customer and payment info:customerName, checkNumber, paymentDate, and amount. CREATE PROCEDURE getPayments(IN cust_name VARCHAR(255)) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Database =
classicmodelsDump file: classicmodels.sql
DB Schema
Stored Procedures
Create a stored procedure named
getEmployees()to display the following employee and their office info:name,city,state, andcountry.Create a stored procedure named
getPayments()that prints the following customer and payment info:customerName,checkNumber,paymentDate, andamount.Beta Was this translation helpful? Give feedback.
All reactions