LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Hierarchical and Recursive Queries in SQL Server

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

-- 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;
Code bearbeiten und ausführen