Accessing the Database with Transact-SQL
All right, enough talk. To actually run the examples today, you will need to build the following database tables in a database named BASEBALL. This database is used in today's Transact-SQL examples.
The BASEBALL Database
The BASEBALL database consists of three tables used to track typical baseball information: the BATTERS table, the PITCHERS table, and the TEAMS table.
The BATTERS Table
NAME char(30) TEAM int AVERAGE float HOMERUNS int RBIS int
The preceding table can be created using the following Transact-SQL statement:
1> create database BASEBALL on default 2> go 1> use BASEBALL 2> go 1> create table BATTERS ( 2> NAME char(30), 3> TEAM int, 4> AVERAGE float, 5> HOMERUNS int, 6> RBIS int) 7> go
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.