From the course: SQL Server 2014 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a table using T-SQL - SQL Server Tutorial
From the course: SQL Server 2014 Essential Training
Creating a table using T-SQL
- Now, let's look at creating an additional table. We'll use T-SQL commands to create this table. I staged some code for you in your exercise files, so you can take all of that code and copy and paste it into Management Studio. Into a new query window. And make sure you're executing against the lynda demo database. Before we run this code, let's talk about it a little bit. The first line, line one, has the keyword CREATE, the keyword TABLE, and then Orders. The name of our table is going to be Orders. And then in parentheses, it lists out four columns. So lines two, three, four and five, each represent one column. The first column, defined on line two, will be called OrderID. The data type will be integer. It will be an identity column, and we set it to NOT NULL. Then, you'll notice there's a comma. And on line three we set up the next column. The column will be called PersonID, the datatype integer, and again, NOT NULL, again a comma. Line four creates a column called OrderAmount…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.