Search⌘ K
AI Features

Question: Insert a Record

Explore how to insert a new record into an Employees table using the SQL INSERT INTO statement. This lesson helps you practice adding data correctly, focusing on adding a new employee with specific details. Understand the syntax and execution required to update a company database effectively.

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. To complete this task, you will need to use the INSERT INTO SQL statement to add this new record to 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: