MYSQL

Bài 1: Tối ưu hóa truy vấn
Cho bảng orders có cấu trúc như sau:

CREATE TABLE orders (
order_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
product_id INT,
order_date DATE,
quantity INT,
total_price DECIMAL(10, 2),
INDEX (customer_…


This content originally appeared on DEV Community and was authored by Nguyen Hoang

Bài 1: Tối ưu hóa truy vấn
Cho bảng orders có cấu trúc như sau:

CREATE TABLE orders (
  order_id INT PRIMARY KEY AUTO_INCREMENT,
  customer_id INT,
  product_id INT,
  order_date DATE,
  quantity INT,
  total_price DECIMAL(10, 2),
  INDEX (customer_id),
  INDEX (order_date)
);

Yêu cầu:
Truy vấn để tìm danh sách các khách hàng có tổng giá trị đơn hàng lớn hơn 10000 trong năm 2023.
Cải thiện hiệu suất của truy vấn trên bằng cách thêm hoặc thay đổi các chỉ mục phù hợp.


This content originally appeared on DEV Community and was authored by Nguyen Hoang


Print Share Comment Cite Upload Translate Updates
APA

Nguyen Hoang | Sciencx (2024-09-10T02:40:00+00:00) MYSQL. Retrieved from https://www.scien.cx/2024/09/10/mysql/

MLA
" » MYSQL." Nguyen Hoang | Sciencx - Tuesday September 10, 2024, https://www.scien.cx/2024/09/10/mysql/
HARVARD
Nguyen Hoang | Sciencx Tuesday September 10, 2024 » MYSQL., viewed ,<https://www.scien.cx/2024/09/10/mysql/>
VANCOUVER
Nguyen Hoang | Sciencx - » MYSQL. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/10/mysql/
CHICAGO
" » MYSQL." Nguyen Hoang | Sciencx - Accessed . https://www.scien.cx/2024/09/10/mysql/
IEEE
" » MYSQL." Nguyen Hoang | Sciencx [Online]. Available: https://www.scien.cx/2024/09/10/mysql/. [Accessed: ]
rf:citation
» MYSQL | Nguyen Hoang | Sciencx | https://www.scien.cx/2024/09/10/mysql/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.