Creating tables in Azure SQL Database:
In Object Explorer, right-click yourDatabase and select New Query. A blank query window opens that is connected to your database.
In the query window, execute the following query to create four tables in your database:
-- Create Person table
CREATE TABLE Person
PersonId INT IDENTITY PRIMARY KEY,
FirstName NVARCHAR(128) NOT NULL,
LastName NVARCHAR(128) NOT NULL,
DateOfBirth DATE NOT NULL
-- Create Student table
CREATE TABLE Student
StudentId INT IDENTITY PRIMARY KEY,
PersonId INT REFERENCES Person (PersonId),
-- Create Course table
CREATE TABLE Course
CourseId INT IDENTITY PRIMARY KEY,
Name NVARCHAR(50) NOT NULL,
Teacher NVARCHAR(256) NOT NULL
-- Create Credit table
CREATE TABLE Credit
StudentId INT REFERENCES Student (StudentId),
CourseId INT REFERENCES Course (CourseId),
Grade DECIMAL(5,2) CHECK (Grade <= 100.00),
CONSTRAINT [UQ_studentgrades] UNIQUE CLUSTERED
StudentId, CourseId, Grade, Attempt
You can see that the 4 tables are created successfully!
Hope this helps!!
To know more about Azure, enroll today with our Azure certification course.