MYSQL COMMANDS REVISION
MYSQL COMMANDS REVISION
• DELETE -
Eg:- DELETE FROM customers WHERE name = 'John';
1. Add coloumns
Eg:- ALTER TABLE customers ADD email VARCHAR(100);
Adds a new column "email" to the "customers" table.
2. Delete coloumn
Eg:-ALTER TABLE customers DROP COLUMN email;
Removes the "email" column from the "customers" table.
2. Rename a column
ALTER TABLE table_name CHANGE old_column_name
new_column_name column_datatype;
Eg:- ALTER TABLE users CHANGE email email_address
VARCHAR(200);
• ORDER BY :-Sort the result set.
1. Descending oder(Highest Order)
Eg:- SELECT * FROM customers ORDER BY age DESC;
AGGREGATE FUNCTIONS
Table:- employee
5. Display the name and salary whose salary between 8000 and 30000.
select Name,Salary from employee where salary between 8000 and 30000;
6. Display all the details of employee whose age greater than 40.
Select * from employee where age>40;
___________