Question: Write an SQL statement to c reate a table called state_tbl with the following fields/attributes: Name as text Capital as text Population as numeric Square_mile

  1. Write an SQL statement to create a table called state_tbl with the following fields/attributes:
  • Name as text
  • Capital as text
  • Population as numeric
  • Square_mile as numeric
  1. Use the PSQL command to display
    1. All relations/tables in your directory
    2. The information about the table you just created
  1. Populate the state_tbl table from a text file using the copy statement to copy data from a tab-delimited text file, which has the same file structure as the table created in question #1.

\copy state_tbl from /home/sql/examples/states.txt

  1. Using your populated state_tbl entity above, write SQL statement to display California State only (your query should return one row).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!