Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. SQL code to create tables: ---------------------------------------------------------------------- Create table Project (ProjectID INT NOT NULL AUTO_INCREMENT, Type VARCHAR(10) NOT NULL, Name VARCHAR(20) NOT NULL, Location VARCHAR(10),

1. SQL code to create tables: ---------------------------------------------------------------------- Create table Project (ProjectID INT NOT NULL AUTO_INCREMENT, Type VARCHAR(10) NOT NULL, Name VARCHAR(20) NOT NULL, Location VARCHAR(10), DateOfFunding DATE, AmountOfFunding DOUBLE, PRIMARY KEY (ProjectID)); Create table Event (EventID INT NOT NULL AUTO_INCREMENT, Description VARCHAR(20) NOT NULL, Location VARCHAR(10) NOT NULL, Date DATE, Sponsor VARCHAR(10), EventFundingGoal VARCHAR(10), CollectedFunds DOUBLE, PRIMARY KEY (EventID)); Create table Donors (DonorsID INT NOT NULL AUTO_INCREMENT, FirstName VARCHAR(10) NOT NULL, LastName VARCHAR(10) NOT NULL, Address VARCHAR(50) NOT NULL, City VARCHAR(10) NOT NULL, State VARCHAR(10), ZipCode VARCHAR(6), Phone VARCHAR(11), Email VARCHAR(255) PRIMARY KEY (DonorsID)); Create table Donations (DonationID INT NOT NULL AUTO_INCREMENT, Amount DOUBLE, Date DATE, TransactionNum VARCHAR(20), DonorsID INT, ProjectID INT, EventID INT, PRIMARY KEY (EventID), FOREIGN KEY (DonorsID) REFERENCES Donors(DonorsID), FOREIGN KEY (ProjectID) REFERENCES Project(ProjectID), FOREIGN KEY (EventID) REFERENCES Event(EventID), ); ----------------------------------------------------------------------- 1. Insert statement: Syntax of 'Insert' statement to add a record to a table is as follows: INSERT INTO (,,...................) VALUES (,,.............................) Ex.: INSERT INTO Project(Type,Name,Location,DateOfFunding,AmountOfFunding) VALUES ("Software","Billing System","Boston","2016-01-01",340.50); Similarly you can insert other records also. 3. Add a new column for fax number to donor table: See the command below: ---------------------------------------------- ALTER TABLE Donors ADD Fax VARCHAR(11); ------------------------------------------------ 4. Select query: ------------------------------------------------------- Select Donor.FirstName, Donors.LastName, Donations.Amount from Donors, Donations where Donors.DonorsID = Donations.DonorsID

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

How many moles are present in 48.8 g of BaCO3?

Answered: 1 week ago