Tables names are not given, According to the 1st Question we have to name them from the given Key names, Like this;
Here is whole Database
ANSWERING YOUR QUESTION
1.
Adding Primary Keys
ALTER TABLE `event` ADD PRIMARY KEY (`eventid`); ALTER TABLE `holder` ADD PRIMARY KEY (`holderid`);
Adding Foreign Key
ALTER TABLE `ticket` ADD KEY `holderid` (`holderid`), ADD KEY `eventid` (`eventid`);
Making Venue Table
CREATE TABLE `venue` ( `venueid` int(3) NOT NULL, `holderid` int(2) NOT NULL, `eventid` int(3) NOT NULL, `venuename` varchar(50) NOT NULL ); ALTER TABLE `venue` ADD PRIMARY KEY (`venueid`), ADD KEY `eventid` (`eventid`), ADD KEY `holderid` (`holderid`);
2.
HolderID from Holder NOT NULL , UNIQUE
EventID from Event NOT NULL , UNIQUE
VenueID from NOT NULL , UNIQUE
TicketNumber from Ticket NOT NULL
3.
(a) It will produce error if set as default policy
Cannot delete or update a parent row: a foreign key constraint fails
Tables names are not given, According to the 1st Question we have to name them from...
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...
Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...
Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...
Language SQL Need help with SQL Question Create a view vHW1_8_xxxx listing the guest name, number of days and the amount each guest needs to pay to the hotels for their stays. Your result should not include any unknown value in the dateto. Your result should include guest name, hotel name, number of days, and amount to pay. Here is my code: select guestname, hotelname, datediff(dateto,datefrom), sum(datediff(dateto,datefrom)*price) from Guest g, Hotel h, Room r, Booking b where h.hotelno=b.hotelno and r.roomno=b.roomno...
Still working on SQL, but now trying to run some commands to pull data from the databases. The last 3 statements Im getting errors but I am not sure how to fix them. What do I need to do differently to those statements to make it work? create table Employee( EmpID char(10), Name varchar2(50), Salery char(10), Address varchar2(50), HireDate date, Phone char(10), Primary key(EmpID)) ; create table Inventory( ProductID char(10), ProductName varchar2(50), UnitPrice char(10), CurrentInventory char(10), MonthlySales char(10), PrecentOfPrice char(10),...
Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and phones of all swimmers currently in level (of id) 3. +-------+---------+---------------------------+ | FName | LName | EMail | +-------+---------+---------------------------+ | Bobby | Khan | theBKhan1 | | Clara | Johnson | ClaraJohnson_11 | +-------+---------+---------------------------+ 2 rows in set (0.00 sec) (2) Provide the names of swimmers who have signed up to participate in the event '100M Butterfly' of Meet id 1. +-------+---------+ | FName...
These question is for mysql, so I want know what is answer
that is information for source:
DROP DATABASE IF EXISTS travel;
CREATE DATABASE travel;
USE travel;
--
-- Table structure for table `equipment`
--
DROP TABLE IF EXISTS `equipment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `equipment` (
`EquipID` int(11) NOT NULL DEFAULT '0',
`EquipmentName` varchar(50) NOT NULL DEFAULT '',
`EquipmentDescription` varchar(100) NOT NULL DEFAULT '',
`EquipmentCapacity` int(11) NOT NULL DEFAULT '0',...
SQL problem solving help; First 3 tables are finnished; Need
help understanding on how to do steps after.
First 3 tables are after the first 2 images for reference if
needed.
//1//
CREATE TABLE kr_customer (
Name VARCHAR(40) NOT NULL PRIMARY KEY,
City VARCHAR(20),
Status CHAR(1)
);
//2//
CREATE TABLE kr_salesperson (
Name VARCHAR(40) NOT NULL PRIMARY KEY,
Age INT,
Salary DECIMAL(8, 2)
);
//3//
CREATE TABLE kr_order (
Order_Number number(3) NOT NULL PRIMARY KEY,
Customer_Name VARCHAR(40),
Salesperson_Name VARCHAR(40),
Amount...
WRITE SQL QUERY THAT DOES THE FOLLOWING Q3| Find the customer's name and branch names of all customers who do have accounts but not a loan in the bank. And find those customers who do have loan but not have an account in the bank. GIVEN DATABASE TABLES 2 Account table Branch table Customer table Loan table BNAME 3 A# CNAME BNAME BAL BNAME ASSETS BCITY CNAME STREET CCITY CNAME AMT 1234 Baba 2222 Rahimi Sauthdale Ridgedale 150eee Minnetonka Minnetonka...
I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...