0% found this document useful (0 votes)
6 views

Data Manipulation SQL Queries

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Data Manipulation SQL Queries

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Manipulation with SQL Queries

#1. Write a SQL query to delete all records from the 'customers' table where the

'last_login_date' is older than 1 year.

DELETE FROM customers_c3

WHERE

last_login_date <= DATE_ADD(CURRENT_DATE(),

INTERVAL - 1 YEAR);

#2. Write a SQL query to insert new records into the 'employees' table, selecting data from

the 'temp_employees' table.

INSERT INTO employees_2 (employee_id, employee_name, department,

hire_date)

SELECT employee_id, employee_name, department, hire_date

FROM temp_employees_2;

#3. Write a SQL query to update the 'discount' column of the 'orders' table by increasing it by

5% for all orders placed before a specific date.

UPDATE orders_3

SET discount = 1.05 * discount

WHERE order_date < '2023-01-07';

You might also like