YHapticY
YHapticY

Reputation: 195

How do you create a row in a table without using the VALUES key word in T-SQL

I got asked an interview question that I haven't a clue how to answer and was curious how you would write a script for something like this.

"Write a statement that creates a row representing you in the Employees table without using the VALUES key word."

How would you create a new row in a table and then add your name to the row without using the VALUES() keyword?

This is the only what that I know how to do something like this but it involves using the VALUES keyword.

INSERT INTO Employees (FirstName, LastName)
VALUES ('John', 'Johnson');

Upvotes: 0

Views: 177

Answers (1)

juergen d
juergen d

Reputation: 204746

insert into Employees (FirstName, LastName)
select 'John', 'Johnson'

That way you can easily insert records from other tables or even use joins.

Upvotes: 2

Related Questions