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 1: Transact-SQL

1.3: Create Table

Previous1.2: Drop DatabaseNext1.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 Visual Studio. 1. Open Visual Studio.

  1. Go to View, then click on "SQL Server Object Explorer."

  2. Click on "(localdb)\MSSQLLocalDB."

  3. Click on "Databases."

  4. Click on "SQL_Library."

  5. Click on the "New Query" icon (circled in purple in the screenshot below).

    • A new window will appear. This is where you will write your SQL query (green box).

    • When you are ready to run your query, click the green play button (circled in yellow).

    • Your query output will appear at the bottom of the screen (red box).

    • Make sure to click the blue arrow button (circled in aqua) every time you make a change to your database to refresh the view in your SQL Server Object Explorer window.

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

Part 1.4: Insert
1.12 Solutions
Query View in Visual Studio