ANSWER
1. SQL Statement
create table pet_owner(ownerID int not null
auto_increment,
ownerlastname varchar(10),ownerfirstname varchar(10),
ownerphone varchar(15), owneremail varchar(20),
primary key(ownerID));
Output Screen
![MySQL [(none)]> use pet; Database changed MySQL [pet]> create table pet_owner(ownerID int not null auto_increment, ownerlastn](http://img.homeworklib.com/questions/131551d0-be97-11eb-b48b-416874b6a259.png?x-oss-process=image/resize,w_560)
Records are inserted as follows.
insert into
pet_owner(ownerlastname,ownerfirstname,ownerphone,owneremail)
values("Jack","Smith","98764521","abc@hmail.com");
insert into
pet_owner(ownerlastname,ownerfirstname,ownerphone,owneremail)
values("Johk","Adams","98799521","klm@hmail.com");
insert into
pet_owner(ownerlastname,ownerfirstname,ownerphone,owneremail)
values("Joe","Mark","98964521","mnp@hmail.com");
![MySQL [pet]> insert into pet_owner(ownerlastname, ownerfirstname, ownerphone, owneremail) -> values(Jack, Smith, 9876452](http://img.homeworklib.com/questions/138367c0-be97-11eb-bd45-71b936329943.png?x-oss-process=image/resize,w_560)
2. SQL statement given below.
create table pet(petId int not null
auto_increment,
petname varchar(20), pettype varchar(20), petbreed
varchar(20),
petdob date, ownerid int, primary key(petid));
Output screen
![MySQL [pet]> create table pet(petId int not null auto_increment, -> petname varchar(20), pettype varchar(20), petbreed varcha](http://img.homeworklib.com/questions/13f00240-be97-11eb-a82d-23ec46aa6173.png?x-oss-process=image/resize,w_560)
3. SQL statement is given below.
Alter table pet add foreign key(ownerid) references pet_owner(ownerid);
Output screen
![MySQL [pet]> Alter table pet add foreign key (ownerid) references pet_owner(ownerid); Query OK, o rows affected (0.158 sec) R](http://img.homeworklib.com/questions/144ab1d0-be97-11eb-a485-c1acc606ad91.png?x-oss-process=image/resize,w_560)
1. Write SQL CREATE Table statement to create the following table with Owner ID as a...
Sample data for these tables are shown in Figures 3-26 and 3-27. For each SQL statement you write, show the results based on these data. If possible, run the statements you write for the questions that follow in an actual DBMS, as appropriate, to obtain results. Use data types that are consistent with the DBMS you are using. If you are not using an actual DBMS, consistently represent data types by using either the MySQL, Microsoft SQL Server, or Oracle...
write an SQL statement to list all the people in the Owner table, along with their pets' names if any. That is, for each pet an owner has, there will be a record containing the owner and the pet's name. For any owner contained in the Owner table, the output should always contain the owner's record even if no pets are associated with this owner. Hint: outer join/s may be needed. -- DROP TABLE PetAndOwner, Pet, PetType, Owner; CREATE TABLE...
The following is the relation notation of the Veterinary Office List. VETERINARY_OFFICE (PetID, PetName, PetType, PetBreed, OwnerID, OwnerLastName, OwnerFirstName, ServiceDescription, ServiceDate, ServiceCharge) The functional dependencies are given below: PetID -> PetName, PetType, PetBreed, OwnerID, OwnerLastName, OwnerFirstName OwnerID -> OwnerLastName, OwnerFirstName ServiceDescription -> ServiceCharge PetID, ServiceDate -> ServicedDescription, ServiceCharge Assumption: A pet belongs to only one owner, while an owner may have more than one pet. A pet receives at most one treatment on any given date. Use the functional dependencies...
2. The following is the relation notation of a table for a veterinary office. [70 pts. total] VETERINARY_OFFICE (PetID, PetName, PetType, PetBreed, OwnerID, OwnerLastName, OwnerFirstName, ServiceDescription, ServiceDate, ServiceCharge) The functional dependencies are given below: PetID -> PetName, PetType, PetBreed, OwnerID, OwnerLastName, OwnerFirstName OwnerID -> OwnerLastName, OwnerFirstName ServiceDescription -> ServiceCharge PetID, ServiceDate > ServiceDescription, ServiceCharge Assumptions: 1)A pet belongs to only one owner, 2) an owner may have more than one pet, 3A pet receives at most one treatment on any...
Create a T-SQL statement that creates a table called Owner as part of a schema called PetStore. Create the table to have 2 columns with the following criteria: Column OwnerID of type int. Make this column an IDENTITY column starting with seed 1 and incrementing by 1 Column OwnerName of type varchar and length 50, not null
Assume that Garden Glory designs a database with the following tables: OWNER (OwnerID, OwnerName, OwnerEmailAddress, OwnerType) OWNED_PROPERTY (PropertyID, PropertyName, PropertyType, Street, City, State, Zip, OwnerID) GG_SERVICE (ServiceID, ServiceDescription, CostPerHour); EMPLOYEE (EmployeeID, LastName, FirstName, CellPhone, ExperienceLevel) PROPERTY_SERVICE (PropertyServiceID, PropertyID, ServiceID, ServiceDate, EmployeeID, HoursWorked) The referential integrity constraints are: OwnerID in OWNED_PROPERTY must exist in OwnerID in OWNER PropertyID in PROPERTY_SERVICE must exist in PropertyID in OWNED_ PROPERTY ServiceID in PROPERTY_SERVICE must exist in ServiceID in GG_SERVICE EmployeeID in PROPERTY_SERVICE must exist...
The following SQL DDL script creates a database for a social network application. create table userProfile( id char(10) primary key, firstName varchar(20), lastName varchar(20), dob date, email varchar(30) ); create table foaf( userid char(10), friendID char(10), timeEstablished date, constraint pk primary key(userid, friendID), constraint fk1 foreign key(userid) references userProfile(id), constraint fk2 foreign key(friendID) references userProfile(id) ); create table activity( actID char(20) primary key, topic varchar(20), description varchar(100), location varchar(20), ActivityDate date, hostUser char(10), foreign key(hostUser) references userProfile(id) ); create table...
Write an SQL CREATE statement to create the structure of a table to store the following employee information empLastName, empFirstName, Dept (foreign key to department table), emp Address, empZip, empCity, empState. Use appropriate data types to reflect the data which will be stored in each attribute. Identify attributes which should not be null by using the correct SQL statements in the create statement
Assume that The Queen Anne Curiosity Shop designs a database with the following tables. CUSTOMER (CustomerID, LastName, FirstName, EmailAddress, EncyptedPassword, City, State, ZIP, Phone, ReferredBy) EMPLOYEE (EmployeeID, LastName, FirstName, Position, Supervisor, OfficePhone, EmailAddress) VENDOR (VendorID, CompanyName, ContactLastName, ContactFirstName, Address, City, State, ZIP, Phone, Fax, EmailAddress) ITEM (ItemID, ItemDescription, PurchaseDate, ItemCost, ItemPrice, VendorID) SALE (SaleID, CustomerID, EmployeeID, SaleDate, SubTotal, Tax, Total) SALE_ITEM (SaleID, SaleItemID, ItemID, ItemPrice) The referential integrity constraints are: ReferredBy in CUSTOMER must exist in CustomerID in CUSTOMER Supervisor...
1) Write a SQL code in order to create a table name Employee with Emp_ID (3 characters), Last_Name (20 characters), and First_Name (15 characters), the primary key is Emp_ID (Note: make sure this code will run on SQL view on Access database) 2) Write a SQL code to remove the table Employee that will remove both the structure and the content of the table. (