StayWell manages the owner information about every property under their management. Since the owners are essential to the operations, their addresses (with city, state, and zip code) are collected. Create the OWNER table, it should have the following data? OWNER_NUM as fixed-length 5 characters LAST_NAME as maximum 20 characters FIRST_NAME as maximum 20 characters ADDRESS as maximum 100 characters CITY as maximum 20 characters STATE as fixed-length 2 characters ZIP_CODE as fixed-length 5 characters All fields are mandatory and cannot be empty

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter3: Creating Tables
Section: Chapter Questions
Problem 1CAT
icon
Related questions
icon
Concept explainers
Question

StayWell manages the owner information about every property under their management. Since the owners are essential to the operations, their addresses (with city, state, and zip code) are collected. Create the OWNER table, it should have the following data?

  • OWNER_NUM as fixed-length 5 characters
  • LAST_NAME as maximum 20 characters
  • FIRST_NAME as maximum 20 characters
  • ADDRESS as maximum 100 characters
  • CITY as maximum 20 characters
  • STATE as fixed-length 2 characters
  • ZIP_CODE as fixed-length 5 characters

All fields are mandatory and cannot be empty

Expert Solution
SQL Query

 

CREATE TABLE OWNER (
    OWNER_NUM CHAR(5) NOT NULL,
    LAST_NAME VARCHAR(20) NOT NULL,
    FIRST_NAME VARCHAR(20) NOT NULL,
    ADDRESS VARCHAR(100) NOT NULL,
    CITY VARCHAR(20) NOT NULL,
    STATE CHAR(2) NOT NULL,
    ZIP_CODE CHAR(5) NOT NULL,
    PRIMARY KEY (OWNER_NUM)
);

You can then insert data into the table using an INSERT INTO statement:

INSERT INTO OWNER (OWNER_NUM, LAST_NAME, FIRST_NAME, ADDRESS, CITY, STATE, ZIP_CODE)

VALUES ('00001', 'Smith', 'John', '123 Main St', 'Anytown', 'NY', '11111'),

('00002', 'Johnson', 'Jane', '456 Elm St', 'Anytown', 'NY', '11112'),

('00003', 'Williams', 'Jim', '789 Oak St', 'Anytown', 'NY', '11113');

 

Finally, you can retrieve the data from the table using a SELECT statement:

SELECT * FROM OWNER;

This will return the following data:

OWNER_NUM | LAST_NAME | FIRST_NAME | ADDRESS | CITY | STATE | ZIP_CODE
----------|-----------|----------- |----------------------|-----------|-------|---------
00001 | Smith | John | 123 Main St | Anytown | NY | 11111
00002 | Johnson | Jane | 456 Elm St | Anytown | NY | 11112
00003 | Williams | Jim | 789 Oak St | Anytown | NY | 11113

 

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Query Syntax
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
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning