Wednesday, January 19, 2011

Creating Tables

This post will build off the I Break Code's Create Database post where a database was created with the name "Library".

The following SQL statements will create two tables with some columns called "Books" and "Authors".

  1. USE Library;
  2. CREATE TABLE Books
  3. (
  4.     book_ID int identity(1,1) PRIMARY KEY
  5.     , title varchar(50) NOT NULL
  6.     
  7.     , genre varchar(25)
  8.     , description varchar(100)
  9. );
  10. CREATE TABLE Authors
  11. (
  12.     author_ID int identity(1,1) PRIMARY KEY
  13.     , first_Name varchar(25) NOT NULL
  14.     , last_Name varchar(50) NOT NULL
  15. );

The tables will be created with some columns inside of them. If you don't understand some of the syntax, just post a comment and I'll try to reply to it either directly or with a post explaining that topic.

No comments:

Post a Comment

I Break Code Where code gets done.
ASP.NET | HTML | SQL Server | VB.NET | Request A Topic |