...

/

Question: Insert a Record

Question: Insert a Record

Learn how to insert a new record in a table using an SQL query.

Question

Given the following Employees table structure:

Employees

EmpID

EmpName

Salary

1

Susan Lee

50000.00

2

Alexa Smith

60000.00

3

Dana Amberson

45000.00

4

Sarah Ronald

47000.00

Additional information

You are provided with a table named Employees that contains the following columns:

  • EmpID: Unique identifier for each employee

  • EmpName: The name of the employee

  • Salary: The salary of an employee

Let’s consider the Employees table. There is a task for you: you are required to update the company database to include information about a new employee, Aliza John, who is joining the team with a salary of $65,000 and an Employee ID of 5. Can you write a simple SQL query to insert this new record into the table? It’s like adding Aliza to the company’s digital family.

Let’s see how you accomplish this task!

Expected output

After inserting the record, you need to get the record of an employee having 5 as EmpID. The expected output is shown below:

EmpID

EmpName

Salary

5

Aliza John

65000.00

Try it yourself

You can try to write a query in the following playground:

MySQL
/* Write your query below */
/* Retrieve the records in the table where EmpID is 5 */
SELECT * FROM Employees
WHERE EmpID = 5;

Hints

Below are some hints to help you understand these concepts better:

Access this course and 1200+ top-rated courses and projects.