SQL Select Statement का सबसे ज्यादा उपयोग SQL Command मे किया जाता है.
SQL Select Statement मे Database एक Table से Query या Data को प्राप्त करने के लिए उपयोग किया जाता है.
Select Statement एक Database पर सबसे अधिक बार Used किया जाता है.
एक Simple SQL SELECT Statement बनाने के लिए Column(s) name और Table Name को Define करना होता है.
आप किसी भी Table से सभी Columns को select कर सकते है या SQL SELECT Statement का उपयोग करके केवल Particular Database को Select कर सकते है.
Selected Data को एक Result Table मे Store किया जाता है जिसे Result Set भी कहा जाता है.
SELECT expressions
FROM tables
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]];
एक सीएसएस से सभी Fields को Select करने के लिये कैसे SQL SELECT Statement का उपयोग करते है आप नीचे देख सकते है.
Customer Id | Last Name | First Name | Favorite Website |
---|---|---|---|
7856 | Grace | Anna | facebook.com |
7126 | Lane | Anna | yahoo.com |
7836 | Bee | Bettie | google.com |
7156 | Bell | Betty | w3org.com |
7056 | Grace | Emma | wik.com |
7446 | Michelle | Sarah | tutorialsroot.com |
SELECT *
FROM customers
WHERE favorite_website = 'tutorialsroot.com'
ORDER BY last_name Michelle;
आप Table मे Individual Fields को Select करने के लिये SQL SELECT Statement का उपयोग करते है.
जैसा कि Table में सभी Fields के Opposite मे है.
Supplier Id | Supplier Name | City | State |
---|---|---|---|
120 | Microsoft | Spokane | Washington |
210 | Green Sector | Los Angeles | California |
340 | Electronics | San Francisco | California |
490 | Verizon | Irving | Houston |
700 | Food and kindred products | Little Rock Arkansas | Arkansas |
200 | Aurora Health Care | Milwaukee | Wisconsin |
450 | Pearson Industries | Green Bay Wisconsin | Wisconsin |
150 | Transportation equipment | Augusta Georgia | Georgia |
870 | Printing and publishing | Marietta Georgia | Georgia |
SELECT supplier_name, city
FROM suppliers
WHERE supplier_id > 150
ORDER BY supplier_name ASC, city DESC;