Chọn Cơ Sở Dữ Liệu Cần Thao Tác Với Lệnh USE Trong SQL - Deft Blog
Có thể bạn quan tâm
Mục lục
- 1 Cú pháp của lệnh USE trong SQL
- 2 Ví dụ về lệnh USE trong SQL
Khi có nhiều cơ sở dữ liệu trong SQL Schema, để bắt đầu một hành động nào đó bạn cần chọn cơ sở dữ liệu để thực thi những hàng động đó. Nếu không chúng ta cần chỉ rõ cơ sở dữ liệu cần thao tác trong câu truy vấn. Thế nhưng cách này khá bất tiện khi chúng ta có hàng loạt câu truy vấn cần thực hiện.
Lệnh USE trong SQl được sử dụng để chọn bất kỳ cơ sở dữ liệu nào đã có trong SQL Schema. Kể từ đó, chúng chúng ta chỉ cần thực thi truy vấn mà không cần quan tâm đến database.
Cú pháp của lệnh USE trong SQL
<span class="pln">USE ten_co_so_du_lieu</span><span class="pun">;</span>Lưu ý: ten_co_so_du_lieu luôn phải là duy nhất trong RDBMS.
Ví dụ về lệnh USE trong SQL
Bạn có thể kiểm tra cơ sở dữ liệu như trong ví dụ dưới đây:
SQL> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | School | | Product | +--------------------+Giờ bạn muốn làm việc với cơ sở dữ liệu School, thì chỉ lần thực thi lệnh USE như dưới đây và bắt đầu làm việc với cơ sở dữ liệu School:
USE School;Sau đó chúng ta có thể thoải moái thực thi truy vấn. Các tên bảng xuất hiện trong các câu truy vấn sẽ ngầm định hiểu là tìm trong database Student.
Ví dụ lấy tất cả các sinh viên trong bảng Student
Select * from Student Prev Article Next Article 0 0 votes Article Rating Subscribe Login Notify of new follow-up comments new replies to my comments

Bài viết liên quan
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More
In case of sale of your personal information, you may opt out by using the link Do Not Sell My Personal Information
Accept Decline Cookie Settings I consent to the use of following cookies: Necessary Marketing Analytics Preferences Unclassified Cookie Declaration About Cookies Necessary (0) Marketing (0) Analytics (0) Preferences (0) Unclassified (0) Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies. We do not use cookies of this type. Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers. We do not use cookies of this type. Analytics cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously. We do not use cookies of this type. Preference cookies enable a website to remember information that changes the way the website behaves or looks, like your preferred language or the region that you are in. We do not use cookies of this type. Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies. We do not use cookies of this type. Cookies are small text files that can be used by websites to make a user's experience more efficient. The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages. Cookie SettingsDo you really wish to opt-out? Close
Cancel Confirm wpDiscuz0Would love your thoughts, please comment.x()x| ReplyInsertTừ khóa » Trong Mysql Câu Lệnh Use
-
Lệnh USE Trong SQL để Chọn Cơ Sở Dữ Liệu
-
Các Câu Lệnh MySQL Quan Trọng Cần Phải Biết - Học VPS
-
Lệnh USE Trong SQL để Chọn Cơ Sở Dữ Liệu
-
Sử Dụng Lệnh USE Trong MySQL để Chuyển đổi Cơ Sở Dữ Liệu
-
Trong MySQL, Câu Lệnh USE
-
Trong MySQL, Câu Lệnh USE - Trắc Nghiệm Online
-
Trong MySQL, Câu Lệnh USE - Trắc Nghiệm Online
-
MySQL Cơ Bản - Viblo
-
Trong MySQL, Câu Lệnh USE | 7scv: Học Các Môn Từ Lớp 1 đến Lớp 12
-
Hỏi: Trong MySQL, Câu Lệnh USE
-
Chọn Database Trong MySQL - Học MySQL Online - Viettuts
-
Select Database Trong SQL - Học Sql Cơ Bản đến Nâng Cao - VietTuts
-
Quản Trị MySQL Cơ Bản
-
Một Số Câu Lệnh Cơ Bản Và Nâng Cao MySQL