15. List the first name for all contacts and whether they have a spouse or not (yes/no). Order by the first name. For example, your result set might look like this: I fÅKstname | Married? | Biff | George | Jennifer | Lorraine | Marty | no | yes | no | yes | no

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter2: Database Design Fundamentals
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question
15. List the first name for all contacts and whether they have a spouse or not (yes/no). Order by the first
name. For example, your result set might look like this:
| firstname
| Married?
| Biff
| George
| Jennifer
| Lorraine
| Marty
| no
| yes
| no
| yes
| no
Transcribed Image Text:15. List the first name for all contacts and whether they have a spouse or not (yes/no). Order by the first name. For example, your result set might look like this: | firstname | Married? | Biff | George | Jennifer | Lorraine | Marty | no | yes | no | yes | no
For the remaining questions, use the following table of people:
people (id (pk), firstname, lastname, spouse_id (fk))
The table was created as:
CREATE TABLE people (id INT NOT NULL AUTO INCREMENT PRIMARY KEY,
firstname VARCHAR(30), lastname VARCHAR (30), spouse id INT,
CONSTRAINT spouse fk FOREIGN KEY (spouse id) REFERENCES people (id));
This is some sample data:
Participation Activity 9
+----
| id | firstname | lastname | spouse_id |
+
1 | Marty
2 | Jennifer
| McFly
| Parker
| McFly
| Tannen
| McFly
|
|
3 | Lorraine
4 | Biff
5 | George
NULL |
NULL |
5 |
NULL |
3 |
+----+--
Transcribed Image Text:For the remaining questions, use the following table of people: people (id (pk), firstname, lastname, spouse_id (fk)) The table was created as: CREATE TABLE people (id INT NOT NULL AUTO INCREMENT PRIMARY KEY, firstname VARCHAR(30), lastname VARCHAR (30), spouse id INT, CONSTRAINT spouse fk FOREIGN KEY (spouse id) REFERENCES people (id)); This is some sample data: Participation Activity 9 +---- | id | firstname | lastname | spouse_id | + 1 | Marty 2 | Jennifer | McFly | Parker | McFly | Tannen | McFly | | 3 | Lorraine 4 | Biff 5 | George NULL | NULL | 5 | NULL | 3 | +----+--
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Complex Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr