question archive How do I write the code in sql to create a table that has the following: Create BusinessEntityID column as an integer

How do I write the code in sql to create a table that has the following: Create BusinessEntityID column as an integer

Subject:Computer SciencePrice:1.87 Bought8

How do I write the code in sql to create a table that has the following:

  1. Create BusinessEntityID column as an integer. Include a DoB (Date of Birth) column and a date format.
  2. Add a constraint to make BusinessEntityID a primary key.
  3. Insert one record for BusinessEntityID 1 and include 1990/01/01 as the birthday.
  4. Once added, query your new table showing the new record

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

We can create the table using below script:

CREATE TABLE BirthDay(
   BusinessEntityID INT NOT NULL,
   DoB DATE,
   CONSTRAINT pk_BD PRIMARY KEY(BusinessEntityID)
);

Inserting the given record:

INSERT INTO BirthDay(BusinessEntityID, DoB)
VALUES(1, '1990-01-01');

Querying table to show record:

SELECT * FROM BirthDay;

Create the table using CREATE TABLE command.

Created table named BirthDay, you may change it if needed.

To insert the record, use INSERT INTO statement as written above.

To query the table, write SELECT statement as written above.