We now have two tables in our publishing house: textbook
and author
.
CREATE TABLE textbook (
id integer PRIMARY KEY,
author_id integer,
title varchar(64),
subject varchar(32),
retail_price decimal(5, 2),
printing_cost decimal(5, 2),
year integer,
FOREIGN KEY (author_id)
REFERENCES author(id)
);
CREATE TABLE author(
id integer PRIMARY KEY,
full_name varchar(32)
);
We want to create a view which will present some data to customers who visit the company website. Obviously, we want to hide information such as printing_cost
.
Create a view named website_textbook_author
that will show the following information from the textbook
and author
tables: the textbook ID, the author's full name, and the book's title, subject, and retail price.