|
SQL Server Examples:
Creating a Table 1 |
|
Table Creation With Data Entry |
|
IF EXISTS(SELECT name
FROM sysobjects
WHERE name = N'Departments'
AND type = 'U')
DROP TABLE Departments
GO
CREATE TABLE Departments
(
DepartmentID INT PRIMARY KEY NOT NULL Identity(1, 1),
Department VARCHAR(40)
)
GO
INSERT INTO Departments (Department)
VALUES ('Corporate');
INSERT INTO Departments (Department)
VALUES ('Public Relations');
INSERT INTO Departments (Department)
VALUES ('Technical Support');
INSERT INTO Departments (Department)
VALUES ('Sales');
GO