MySQL is one of the most popular relational database management systems (RDBMS) used for managing and organizing large amounts of data in databases. It is an open-source software and supports structured query language (SQL) to interact with the data. MySQL is commonly used for web applications and online transaction processing.
MySQL uses a client-server architecture. Applications (clients) send SQL queries to the MySQL server, which processes them and returns results from databases stored as structured tables.
-- Retrieve all users above the age of 21
SELECT * FROM users WHERE age > 21;
The query returns all records from the users table where the age value is greater than 21.
-- Fetch users from a specific city
SELECT * FROM users WHERE city = 'Pune';
-- Update email of a specific user
UPDATE users SET email='newemail@example.com' WHERE id=1;
-- Insert a new user record
INSERT INTO users (name, email, age, city) VALUES ('Alice', 'alice@example.com', 25, 'Mumbai');
-- Delete a user from the table
DELETE FROM users WHERE id=5;
SELECT * in production queries.UPDATE statement.