Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need 12, 14(the second 14, the 14 closest to 15), and 15. They are incorrect. PERSON: Iname, fname, rname, idnum, private, linkblue lname, fname,

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

I need 12, 14(the second 14, the 14 closest to 15), and 15. They are incorrect.

PERSON: Iname, fname, rname, idnum, private, linkblue lname, fname, rname are variable length strings idnum is type INT and is a key attribute private is BOOLEAN linkblue is string of 8 characters ADDR: idnum, adtype, streetaddr, city, state, country, zip idnum is a foreign key to PERSON.idnum adtype is a string in the set {"bill", "permanent", "local"} streetaddr is a variable length string that includes #, street, and maybe apt # state is a 2 letter char denoting the state country is a 2 letter char denoting country zip is string no bigger than 10 characters. ADVISOR: student, advisor student is a foreign key to PERSON.idnum advisor is a foreign key to PERSON.idnum DIGITAL: smtype, idnum, smaddr smtype is a string in the set {"email", "facebook", "twitter"} idnum is a foreign key to PERSON.idnum smaddr is a variable length string There is a primary key on the pair (smtype, idnum) 1. CREATE TABLE PERSON(idnum INT NOT NULL PRIMARY KEY, Iname VARCHAR (50), fname VARCHAR(50), rname VARCHAR (50), private BOOLEAN, linkblue CHAR (8)); 2. CREATE TABLE ADDR(idnum INT, adtype SET('bill', 'permanent', 'local), streetaddr VARCHAR (50), city VARCHAR (50), state CHAR(2), zip VARCHAR(10), country CHAR(2), PRIMARY KEY(idnum, adtype), FOREIGN KEY(idnum) REFERENCES PERSON(idnum)); 3. CREATE TABLE ADVISOR(student INT, advisor INT, PRIMARY KEY (student, advisor), FOREIGN KEY(student) REFERENCES PERSON(idnum), FOREIGN KEY(advisor) REFERENCES PERSON (idnum)); 4. CREATE TABLE DIGITAL(smtype SET('email', 'facebook', 'twitter'), idnum INT, smaddr VARCHAR(50), PRIMARY KEY(smtype, idnum), FOREIGN KEY(idnum) REFERENCES PERSON (idnum)); #10 What is the value for the pre-existing tuple's sdate and edate entry after you execute the DDL statement from #9? 11-15: 10 pts each These queries should work for ANY data that might be present - not just the data you inserted above. [ADD: I updated this on Monday Feb17 to reflect "people" vs. "student".] - - - - - - - - - ---- #11 Write the DML statement to query the database for all people with email addresses. Output their first and last name and their email address - only those 3 pieces of information. #12 Write the DML statement to query the database for all people with no billing address. #14 Write the DML statement to query the database for all people whose linkblue account is part of DIGITAL.smaddr entry that belongs to them. Output their first and last name and the smtype and smaddr. Sort the output by last name and smtype. #14 Write the DML statement to query the database for all people who do not have the privacy flag set to true, output their first and last name and the number of DIGITAL accounts they have. #15 Write the DML statement to query the database for all peoples' first name, last name, email address, advisor's first name, last name, and twitter address. Hint: This should print out for all people regardless of whether they actually have email addresses or advisors. Advisors should print regardless of whether they have a twitter handle. QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ 12. SELECT * FROM PERSON, ADDR WHERE adtype != 'billAND PERSON.idnum = ADDR.idnum; 14. SELECT fname, Iname COUNT(DIGITAL) FROM PERSON, DIGITAL WHERE private != TRUE AND PERSON.idnum = DIGITAL.idnum; 15. SELECT fname, Iname, smaddr FROM PERSON, DIGITAL, ADVISOR WHERE smaddr != 'facebook AND PERSON.idnum = DIGITAL.idnum; ||

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions