Перейти к содержимому

02 MySQL CRUD Operations

AiCE Community

0:00 / 0:00

02 MySQL CRUD Operations

5 просмотров · 2 нед. назад
AiCE Community
5 подписчиков
5 просмотров · 2 нед. назад
Welcome to Lesson 2 of the MySQL Tutorial for Beginners series! In this lesson, we're going to start working with real data in MySQL by building a small database for an online bookstore called AiCE Books. You'll learn the four fundamental CRUD operations in MySQL: Create, Read, Update, and Delete. We'll create a database, create a table, insert book records, retrieve and filter data, update records, and safely delete data using SQL queries. 📚 COMPLETE MYSQL TUTORIAL PLAYLIST:    • MySQL for Beginners   In this video, you'll learn: ✅ How to log in to MySQL ✅ How to create a MySQL database ✅ How to use a database with USE ✅ How to create a MySQL table ✅ MySQL PRIMARY KEY ✅ AUTO_INCREMENT in MySQL ✅ VARCHAR, INT, DECIMAL and DATE data types ✅ NOT NULL and DEFAULT constraints ✅ How to inspect a table with DESCRIBE ✅ How to insert data using INSERT INTO ✅ How to retrieve data using SELECT ✅ How to select specific columns ✅ How to filter data using WHERE ✅ How to sort data using ORDER BY ✅ How to use ASC and DESC ✅ How to limit results using LIMIT ✅ How to update records using UPDATE ✅ How to delete records using DELETE ✅ The four CRUD operations in MySQL ✅ Important safety rules when using UPDATE and DELETE 💻 MYSQL COMMANDS USED IN THIS LESSON Create a database: CREATE DATABASE aice_books; Select the database: USE aice_books; Create a table: CREATE TABLE books ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100) NOT NULL, author VARCHAR(100) NOT NULL, genre VARCHAR(50), price DECIMAL(6,2) NOT NULL, quantity INT DEFAULT 0, date_added DATE ); View the table structure: DESCRIBE books; Insert data: INSERT INTO books (title, author, genre, price, quantity, date_added) VALUES ('Things Fall Apart', 'Chinua Achebe', 'Fiction', 15.99, 25, '2025-01-10'); Read data: SELECT * FROM books; Select specific columns: SELECT title, author, price FROM books; Filter data: SELECT * FROM books WHERE genre = 'Fiction'; Sort data: SELECT title, price FROM books ORDER BY price ASC; Limit results: SELECT title, price FROM books ORDER BY price ASC LIMIT 3; Update data: UPDATE books SET quantity = 40 WHERE title = 'Sapiens'; Delete data: DELETE FROM books WHERE title = 'The Alchemist'; ⚠️ IMPORTANT MYSQL TIP Always double-check your WHERE clause before running UPDATE or DELETE. Without WHERE, an UPDATE can modify every record in your table, while DELETE can remove every record from the table. This lesson is part of a complete beginner-friendly MySQL course designed to take you from the basics of databases and SQL into practical software development and eventually using MySQL with Python. If you're following the course from the beginning, start with Lesson 1 and continue through the playlist. 📚 COMPLETE COURSE:    • MySQL for Beginners   Don't forget to subscribe and turn on notifications so you don't miss the next lesson, where we'll take what we've learned and start working with MySQL from Python. #MySQL #MySQLTutorial #SQL #CRUD #Database