Write the select statement to show all records

Assignment Help Database Management System
Reference no: EM13886213

Using MySQL commands answer the questions listed below using the Tiny Video schema. Submit via the D2L drop box the final SQL scripts for each problem. You must answer all parts of the question before receiving any partial credit. For example, do not expect any points if all you answer is part b of question 3. Each part builds upon the correct answer of the previous part.

1. Create a view called customer_with_balances that has the following columns: customer_number, customer_lname and customer_balance. The view should only include those customers where the customer balance is greater than zero.

1. a) Create a stored function called get_customer_balance which will return a customer's balance from the membership table by passing in a membership number.

1.  a) Create a trigger called membership_balance_updates that will capture any updates made to the mem_balance column in membership. The trigger should only capture those transactions in which the member's balance actually changes. The mem_num, old mem_balance, new mem_balance, user, transaction date should be placed into a membership_balance_audit table.
Use the following script to create the membership_balance_audit table.

CREATE TABLE IF NOT EXISTS membership_balance_audit

(mem_num INTEGER,

old_mem_balance DECIMAL(10,2),

new_mem_balance DECIMAL(10,2),

transaction_date TIMESTAMP,

transaction_user VARCHAR(50));

a) Write the SELECT statement to show all records in the membership_balance_audit table. (Note: The transaction date will be different for your result set.)

SELECT * FROM membership_balance_audit;

Reference no: EM13886213

Questions Cloud

Estimate the power output of the turbine : A 90% efficient turbine operates between two reservoirs connected by a 200-m length of 40-cm-diameter cast iron pipe that transports 0.8 m3=s of 20-C water. Estimate the power output of the turbine if the elevation difference between the surfaces ..
Factors considered while selecting a boiler : 1. What are the factors considered while selecting a boiler? 2. What are the various boiler mountings? 3. Define vacuum efficiency of condenser? 4. What is the effect of friction on the flow through a steam nozzle?
What is the maximum distance from the lower reservoir : An 88% ef?cient pump is used to transport 30-C water from a lower reservoir through an 8-cm-diameter galvanized iron pipe to a higher reservoir whose surface is 40 m above the surface of the lower one.
Report on management decision making in tbwa organisation : Describe the main issues facing managers for example with, organisational structures authority delegation, control and any other issues that can be identified and explain key concepts, theories and factors that influence behaviour in the TBWA organ..
Write the select statement to show all records : Write the SELECT statement to show all records
Estimate the flow rate between the reservoirs : A 4-cm-diameter cast iron pipe connects two reservoirs with the surface of one reservoir 10 m below the surface of the other. There are two standard screwed elbows and one wide-open angle valve in the 50-m-long pipe.
What is the exit velocity : Water at 20-C flows from a reservoir out a 100-m-long, 4-cm-diameter galvanized iron pipe to the atmosphere. The outlet is 20 m below the surface of the reservoir. What is the exit velocity
Hiring of a system architect : You have been asked to prepare and deliver a presentation to a non-technical manager to justify the hiring of a system architect for a new project. Write a list of bullet points setting out the key points in your presentation. Naturally, you have ..
What pressure drop is to be expected : Air at 35-C and 120 kPa enters a 20 · 50 cm sheet metal conduit at a rate of 6 m3=s. What pressure drop is to be expected over a length of 120 m?

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd