Hi there, we’re Harisystems
"Unlock your potential and soar to new heights with our exclusive online courses! Ignite your passion, acquire valuable skills, and embrace limitless possibilities. Don't miss out on our limited-time sale - invest in yourself today and embark on a journey of personal and professional growth. Enroll now and shape your future with knowledge that lasts a lifetime!".
For corporate trainings, projects, and real world experience reach us. We believe that education should be accessible to all, regardless of geographical location or background.
1MySQL SQL Statements Basics
Introduction
Structured Query Language (SQL) is a standard language for managing relational databases. MySQL, being a popular relational database management system, uses SQL for querying and manipulating data. In this article, we will explore the basics of SQL statements in MySQL and provide examples to illustrate their usage.
SELECT Statement
The SELECT statement is used to retrieve data from one or more tables. It allows you to specify the columns to retrieve, apply filtering conditions, and sort the result set. Here's an example:
SELECT * FROM employees;
INSERT INTO Statement
The INSERT INTO statement is used to add new records (rows) to a table. It specifies the table to insert into and the values for the columns. Here's an example:
INSERT INTO customers (name, email) VALUES ('John Doe', 'john.doe@example.com');
UPDATE Statement
The UPDATE statement is used to modify existing data in a table. It specifies the table to update, the columns to modify, and the new values. Here's an example:
UPDATE employees SET salary = 50000 WHERE id = 1;
DELETE Statement
The DELETE statement is used to remove records from a table. It specifies the table to delete from and optional conditions to filter the records. Here's an example:
DELETE FROM customers WHERE id = 2;
CREATE TABLE Statement
The CREATE TABLE statement is used to create a new table. It specifies the table name, columns, data types, and optional constraints. Here's an example:
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50),
age INT
);
ALTER TABLE Statement
The ALTER TABLE statement is used to modify an existing table. It allows you to add, modify, or delete columns, constraints, and other table elements. Here's an example:
ALTER TABLE employees ADD COLUMN salary DECIMAL(10, 2);
DROP TABLE Statement
The DROP TABLE statement is used to delete an existing table. It specifies the table name to be dropped. Here's an example:
DROP TABLE employees;
Conclusion
SQL statements form the foundation of interacting with MySQL databases. In this article, we explored the basics of SQL statements in MySQL, including SELECT, INSERT INTO, UPDATE, DELETE, CREATE TABLE, ALTER TABLE, and DROP TABLE statements. By mastering these fundamental SQL statements, you can retrieve, manipulate, and manage data in your MySQL databases effectively.
4.5L
Learners
20+
Instructors
50+
Courses
6.0L
Course enrollments
Future Trending Courses
When selecting, a course, Here are a few areas that are expected to be in demand in the future:.
Future Learning for all
If you’re passionate and ready to dive in, we’d love to join 1:1 classes for you. We’re committed to support our learners and professionals their development and well-being.
View CoursesMost Popular Course topics
These are the most popular course topics among Software Courses for learners