MySQL Queries
MySQL Queries
Solution:
2. Write SQL Query to insert any four records in the Employee table.
Insert the following records in the table created above.
Empid Name Department Salary Gender DOJ
1001 Aman Sales 40000 M 2010-11-21
1002 Neha Accounting 35000 F 2009-09-25
1003 Ravi Sales 45000 M 2015-05-02
1004 Sakshi Accounting 35000 F 2016-06-15
Solution:
INSERT INTO Employee VALUES(1001, ’Aman’, ’Sales’, 40000, ‘M’, ‘2010-11-21’);
INSERT INTO Employee VALUES(1002, ’Neha’, ’Accounting’, 35000, ‘F’, ‘2009-09-25’);
INSERT INTO Employee VALUES(1003, ’Ravi’, ’Sales’, 45000, ‘M’, ‘2015-05-02’);
INSERT INTO Employee VALUES(1004, ’Sakshi’, ’Accounting’, 35000, ‘F’, ‘2016-06-15’);
3. Write SQL Query to display all the records of all Female Employees.
Solution:
SELECT * FROM Employee WHERE Gender = ‘F’;
Output:
4. Write SQL Query to display name of employees in upper case who joined on “Wednesday”.
Solution:
SELECT UPPER(Name) FROM Employee WHERE DAYNAME(DOJ) = “Wednesday”;
Output:
UPPER(Name)
SAKSHI
SUM(Salary) Department
90000 Sales
70000 Accounting