SQL-101-Basics
  • Introduction
  • Part 1: Transact-SQL
    • 1.0: Getting Started with T-SQL
    • 1.1: Create Database
    • 1.2: Drop Database
    • 1.3: Create Table
    • 1.4: Insert
    • 1.5: Update
    • 1.6: Read
    • 1.7: Alter
    • 1.8: Customer Table
    • 1.9: Diagramming Notation
    • 1.10: Foreign Keys
    • 1.11: Join
    • 1.12: Solutions
  • Part 2: PostgreSQL
    • 2.0: Getting Started with PostgreSQL
    • 2.1: Create Database
    • 2.2: Drop Database
    • 2.3: Create Table
    • 2.4: Insert
    • 2.5: Update
    • 2.6: Read
    • 2.7: Alter
    • 2.8: Customer Table
    • 2.9: Diagramming Notation
    • 2.10: Foreign Keys
    • 2.11: Join
    • 2.12: Solutions
  • Part 3: T-SQL Challenges
    • 3.0: Introduction
    • 3.1: Challenge 1
    • 3.2: Challenge 2
    • 3.3: Challenge 3
    • 3.4: Challenge 4
    • 3.5: Solutions
  • Part 4: PostgreSQL Challenges
    • 4.0: Introduction
    • 4.1: Challenge 1
    • 4.2: Challenge 2
    • 4.3: Challenge 3
    • 4.4: Challenge 4
    • 4.5: Solutions
  • Part 5: Resources
    • 5.0: Resources
Powered by GitBook
On this page
  1. Part 2: PostgreSQL

2.3: Create Table

Previous2.2: Drop DatabaseNext2.4: Insert

Last updated 7 years ago

Using the SQL_Library database, create a query that creates a table for Products. The table should have the following data:

Name

Type

Null?

ProductID

int/Primary Key

Not

ProductName

varchar(25)

Not

Price

money

Yes

ProductDescription

text

Yes

Below you will find a step-by-step guide to setting up a new query in pgAdmin. 1. Open pgAdmin.

  1. Click on the plus sign next to "Servers."

  2. Click on the plus sign next to the specific server where your the SQL_Library database is located.

  3. Enter the password for that server.

  4. Click on the plus sign next to "Databases."

  5. Right click on the SQL_Library database. A new menu will pop up.

  6. Click on "Query Tool." A new view will pop up on the right side of your pgAdmin screen. You can use to the screenshot below as a reference to see the initial format of this view. Since this view is customizable, your screen might not be identical to the view shown below.

    • Your SQL queries will be typed in the top half of the view (red box in screenshot).

    • Click the lightning bolt (circled in yellow) to run the query.

    • Your query output will be in the bottom half of the screen (green box).

To see the solution for this challenge, click on . Then, continue to .

Part 2.4: Insert
2.12 Solutions
Query View in pgAdmin