ComeçarComece de graça

Creating a table

In this exercise, you will create a new table Person. For this task, you have to

  • define the table by using CREATE TABLE
  • define the necessary fields of the desired table

An example for creating a table Employee is shown below:

CREATE TABLE Employee (
    ID INT,
    Name CHAR(32)
);

Your task is to create a new table, Person, with the fields IndividualID,Firstname,Lastname, Address, and City.

Este exercício faz parte do curso

Hierarchical and Recursive Queries in SQL Server

Ver curso

Instruções do exercício

  • Define the table Person.
  • Define a field IndividualID.
  • Set Firstname and Lastname not to be NULL and of type VARCHAR(255).
  • Define Birthday as DATE.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

-- Define the table Person
CREATE TABLE ___ (
  	-- Define the Individual ID
  	___ INT NOT NULL,
  	-- Set Firstname and Lastname not to be NULL of type VARCHAR(255)
	Firstname VARCHAR(___) NOT NULL,
	Lastname ___(___) ___ ___,
	Address VARCHAR(255) NOT NULL,
  	City CHAR(32) NOT NULL,
   	-- Define Birthday as DATE
  	Birthday ___
);

SELECT * 
FROM Person;
Editar e executar o código