MySQL is a popular open-source relational database management system that is widely used for web applications. It was created in 1995 by Swedish developers Michael Widenius and David Axmark, and is now owned by Oracle Corporation. MySQL is often used in conjunction with other popular web development technologies like PHP, Python, and Ruby on Rails.
Relational databases like MySQL are used to store and manage structured data. They consist of one or more tables, each of which has a set of columns and rows. Each column represents a different type of data (such as a string or integer), while each row represents a single record or entry in the table.
One of the key features of MySQL is its support for SQL (Structured Query Language), a standardized language used to interact with relational databases. SQL allows you to perform a wide variety of operations on your MySQL databases, such as creating tables, inserting data, updating data, and querying data.
Here are some basic MySQL concepts and commands to get you started:
Creating a database
CREATE DATABASE mydatabase;To create a new table in MySQL, you can use the CREATE TABLE command:
CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, age INT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );This will create a new table called "users" with five columns: id, name, email, age, and created_at. The id column is set as the primary key, which means it uniquely identifies each row in the table. The AUTO_INCREMENT keyword tells MySQL to automatically generate a new value for id for each new row added to the table. The NOT NULL keyword means that the name and email columns cannot be empty.
INSERT INTO users (name, email, age) VALUES ('John', 'john@example.com', 25);This will insert a new row into the "users" table with the values "Niraj" for name, "niraj@example.com" for email, and 25 for roll.
SELECT * FROM users;
UPDATE users SET roll = 30 WHERE id = 1;
DELETE FROM users WHERE roll < 20;
0 Comments