SQL Server : CREATE VIEW

Make sure you are using the correct database;

USE MyDatabase;
GO

Create a view.

CREATE VIEW employees_v as
SELECT employee_id,
       first_name + ' ' + last_name as employee_name,
       date_of_birth
FROM employees;

Display the data using the view.

SELECT * FROM employees_v;

Drop the view.

DROP VIEW employees_v;

For more information see:

SQL Server : CREATE TABLE

Make sure you are using the correct database;

USE MyDatabase;
GO

Create a table.

CREATE TABLE employees
(
  employee_id   INT IDENTITY(1,1) PRIMARY KEY,
  first_name    VARCHAR(30),
  middle_names  VARCHAR(100),
  last_name     VARCHAR(30),
  date_of_birth DATE
)

Insert some data.

INSERT INTO employees (first_name, middle_names, last_name, date_of_birth)
VALUES ('Peter', NULL, 'Parker', '2007-05-08');

Display the data in the table.

SELECT * FROM employees;

Drop the table.

DROP TABLE employees;

For more information see:

SQL Server : CREATE DATABASE

Here is a simple example of creating a database in SQL Server.

USER master;
GO

CREATE DATABASE MyDatabase
  ON (
        Name = N'MyDatabase',
        FileName = N'e:\db\MyDatabase.mdf',
        Size = 10MB,
        maxsize = unlimited,
        filegrowth = 1GB
      )
  LOG ON
      (
        Name = N'MyDatabaseLog',
        FileName = N't:\tl\MyDatabase.ldf',
        Size = 10MB,
        maxsize = unlimited,
        filegrowth = 1GB
      )

You will typically see sizes referenced in units of KB, MB, GB or TB.

You can drop a database using the following type of command.

DROP DATABASE MyDatabase

For more information see: