Question

Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial...

Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial number using a stored procedure. The output should display all of the players who use the bat’s manufacturer. If the serial number is also provided, only display the players who use that bat’s manufacturer and serial number. Make sure you use a CREATE PROCEDURE call and insert this procedure into the existing database.

Submit a document that includes:

1. Commented code for the stored procedure to assist future users in understanding the steps/logic you followed

2. A paragraph describing how it could be embedded into a non-SQL program (e.g., a Windows application, a web app, a mobile app, etc.). Why would it be useful to be able to execute a stored procedure from outside an SQL editor?

Tables for the database:

TABLE TEAM - TEAMNUM             VARCHAR(4), TEAMNAME            VARCHAR(15), CITY               VARCHAR(30), MANAGER             VARCHAR(20), CONSTRAINT pk_team PRIMARY KEY (TEAMNUM)

TABLE BATS - SERIALNUM           VARCHAR(3), TEAMNUM             VARCHAR(4), MANUF              VARCHAR(20), CONSTRAINT pk_serialnum           PRIMARY KEY (SERIALNUM), CONSTRAINT fk1_teamnum          FOREIGN KEY (TEAMNUM)REFERENCES TEAM (TEAMNUM)

TABLE COACH - COACHNAME           VARCHAR(20), TEAMNUM             VARCHAR(4), TELEPHONE           VARCHAR(8), CONSTRAINT pk_coachname        PRIMARY KEY (COACHNAME), CONSTRAINT fk1_teamnum          FOREIGN KEY (TEAMNUM)REFERENCES TEAM (TEAMNUM)

TABLE PLAYER - PLAYERNUM           VARCHAR(4), PLAYERNAME          VARCHAR(20), AGE                SMALLINT, CONSTRAINT pk_playernum           PRIMARY KEY (PLAYERNUM)

TABLE AFFILIATION - PLAYERNUM           VARCHAR(4), TEAMNUM             VARCHAR(4), YEARS              SMALLINT, BATTINGAVE          FLOAT, CONSTRAINT pk1_playernum   PRIMARY KEY (PLAYERNUM), CONSTRAINT pk2_teamnum   PRIMARY KEY (TEAMNUM), CONSTRAINT fk1_playernum FOREIGN KEY (PLAYERNUM)REFERENCES PLAYER(PLAYERNUM), CONSTRAINT fk2_teamnum   FOREIGN KEY (TEAMNUM)REFERENCES TEAM (TEAMNUM)

TABLE WORK_EXPERIENCE - TEAMNUM             VARCHAR(4), COACHNAME           VARCHAR(20), EXPERIENCETYPE      VARCHAR(50), YEARSEXPERIENCE     SMALLINT, CONSTRAINT pk1_teamnum           PRIMARY KEY (TEAMRNUM), CONSTRAINT pk2_coachname    PRIMARY KEY (COACHNAME),      CONSTRAINT fk1_teamnum     FOREIGN KEY (TEAMNUM)REFERENCES TEAM (TEAMNUM), CONSTRAINT fk2_coachname         FOREIGN KEY (COACHNAME)REFERENCES COACH (COACHNAME)

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),    ...

    -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),     city varchar(15),     constraint customer_pk         primary key (cid) ); create table Club (     club varchar(15) not null,     desc varchar(50),     constraint club_pk         primary key (club) ); create table Member (     club varchar(15) not null,     cid   smallint     not null,     constraint member_pk         primary key (club, cid),     constraint mem_fk_club         foreign key (club) references Club,     constraint mem_fk_cust...

  • Define an SQL view JokesNum that gives the number of jokes each user posts on each...

    Define an SQL view JokesNum that gives the number of jokes each user posts on each day. Database: create table User( userid varchar(30) not null, password varchar(30), firstname varchar(30), lastname varchar(50), email varchar(50), gender char(1), age integer, banned boolean, primary key(userid), unique(email)); create table MyFriends( userid varchar(30), friendid varchar(30), primary key(userid,friendid), foreign key(userid) references User, foreign key(friendid) references User(userid)); Create table Jokes( Jokeid integer, title varchar(100), description varchar(255), authorid varchar(30) not null, primary key(jokeid), posttime Datetime, foreign key(authorid) references User(userid));...

  • Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a...

    Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a Star Schema from a normalized data model, you will need to denormalize the data model into fact and dimension tables. The diagram should contain all of the facts and dimension tables necessary to integrate the JigSaw operational database into a data warehouse. Write a brief paper describing the challenges you experienced in completing this assignment. -- CREATE DATABASE js; CREATE TABLE buy_methods ( buy_code...

  • In this hands-on project, you will create an application that allows the user to connect to...

    In this hands-on project, you will create an application that allows the user to connect to a database and query the database. Write a Java query application that allows the user to connect to the books database and query the books database. Provide the following predefined queries: Select all authors from the Authors table Select a specific author and list all books for that author. Include each book’s title, year and ISBN. Display the appropriate data for each query. Given...

  • I am trying to delete these tables from my data base and I keep getting: "mysql>...

    I am trying to delete these tables from my data base and I keep getting: "mysql> DROP TABLE Courses; ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails" I am using the command DROP TABLE Courses; Below is my sql file use sdev300; // Create a student table CREATE TABLE Students ( PSUsername varchar(30) primary key, FirstName varchar(30), LastName varchar(30), EMail varchar(60) ); CREATE TABLE Courses( CourseID int primary key, CourseDisc varchar(4), CourseNum varchar(4),...

  • SQL Query Question: I have a database with the tables below, data has also been aded...

    SQL Query Question: I have a database with the tables below, data has also been aded into these tables, I have 2 tasks: 1. Add a column to a relational table POSITIONS to store information about the total number of skills needed by each advertised position. A name of the column is up to you. Assume that no more than 9 skills are needed for each position. Next, use a single UPDATE statement to set the values in the new...

  • Help In Database: Next comes the data entry: Make up data for your database, or find...

    Help In Database: Next comes the data entry: Make up data for your database, or find real data. You can enter the data with INSERT statements, but it is much easier to use PhpAdmin. It has a form where you can type the data directly. Alternatively, you can use PhpAdmin to import CSV data (comma-separated values), which you can export from Excel. Include at least 3 rows in each of the entity relations, and as many rows as you need...

  • SQL Command - Create a view called S LIST that lists the Cardholder Number, last name,...

    SQL Command - Create a view called S LIST that lists the Cardholder Number, last name, first name and due date for all cardholders who have not returned a book. Use the CREATE OR REPLACE VIEW AS ... command. TABLE CARD HOLDERS Cardholder Numberint NOT NULL CONSTRAINT CH PK PRIMARY KEY, First_Name varchar(10) NULL, LastName varchar(15) NULL, Address varchar(20) NULL, varchar(15) NULL, State char(2) NULL, Zip_Code char(5) NULL) City TABLE BOOKS CHECKED OUT Cardholder_Numberint NOT NULL, Book Numberint NOT NULL,...

  • Use an INSERT INTO statement with a subquery containing a SQL string function to create user...

    Use an INSERT INTO statement with a subquery containing a SQL string function to create user names for the volunteers based on their legal names and insert them into the table. +----------------------+ | Tables_in_volunteers | +----------------------+ | address              | | email                | | funds                | | hours                | | person               | | phone                | | users                | +----------------------+ users legal names are in the address table user table is : CREATE TABLE USERS(volunteer_id INT NOT NULL, username VARCHAR(50), PRIMARY KEY...

  • Create three or more MySQL Data Control language (DCL) Statements using the Youth League Database. 1....

    Create three or more MySQL Data Control language (DCL) Statements using the Youth League Database. 1. A Create new user statement for the database 2. A statement that grants privileges to the new user 3. A statement that revokes privileges 1. A SQL Text File containing the SQL commands to create the database, create the table, and insert the sample test data into the table. 2. A SQL Text File containing the DCL SQL Statements. eted hemas Untitled Limit to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT