Introduction MySQL is a powerful ( RDBMS )Relational Database Management System widely used for managing and manipulating data. First, let's define our employee table: CREATE TABLE employee (empno INT PRIMARY KEY, name VARCHAR(255), age INT, country VARCHAR(255) ); This table represents basic employee information with columns for employee number ( empno ), name, age, and country. 1. SELECT - Retrieving Data The SELECT statement retrieves data from a table. To get all data from the employee table: SELECT * FROM employee; Here, * represents all columns. You can also select specific columns: SELECT empno, name FROM employee; 2. WHERE - Filtering Data Use the WHERE clause to filter data based on a condition. For example, to get employees older than 25: SELECT * FROM employee WHERE age > 25; 3. ORDER BY - Sorting Data Sort data using the ORDER BY clause. To get employees sorted by age in descending order: SELECT * FROM employee ORDER BY age DESC; ...
Comments
Post a Comment