MySQL Comments
In this page:
-- single-line comment
# MySQL-style single-line comment
/* multi-line
comment */
Double Dash से Single-Line Comments
एक double-dash (--) एक comment शुरू करता है जो line के अंत तक चलता है, लेकिन standard SQL को dashes के तुरंत बाद एक space चाहिए नहीं तो MySQL इसे बिल्कुल comment नहीं मान सकता।
उदाहरण: Single-Line Comments with Double Dash
-- This is a comment
SELECT 1;
Hash से Single-Line Comments
hash symbol (#) एक MySQL-specific single-line comment marker है जो double-dash जैसा behave करता है लेकिन, इसके उलट, इसे trailing space नहीं चाहिए — दोनों styles के बीच एक छोटा लेकिन आसानी से भूल जाने वाला अंतर।
उदाहरण: Single-Line Comments with Hash
#This is a MySQL-specific comment
SELECT 1;
Multi-Line Comments
Block comments /* से शुरू होते हैं और */ से खत्म होते हैं, और कई lines तक फैल सकते हैं, जो उन्हें किसी complex query के इस तरह structured होने की longer explanations के लिए सही choice बनाता है।
उदाहरण: Multi-Line Comments
/* This is a
multi-line comment */
SELECT 1;
SQL Statements के अंदर Comments
आप एक block comment को किसी statement के बीच में, किसी column name या clause के ठीक बगल में डाल सकते हैं, आसपास के SQL syntax को तोड़े बिना यह document करने के लिए कि वह हिस्सा exactly क्या करता है।
उदाहरण: Comments inside SQL Statements
SELECT name /* the customer's full name */ FROM customers;
Executable Comments
MySQL एक special executable comment syntax (/*! ... */) support करता है जिसे दूसरे database systems बस एक normal comment मानकर ignore कर देते हैं, आपको MySQL-specific optimizations लिखने देते हुए जो दूसरे engines के लिए portable रहती हैं।
उदाहरण: Executable Comments
SELECT /*! SQL_NO_CACHE */ * FROM customers;
- दो dashes के बाद बिना space के
--commentलिखना, जबकि MySQL को एक comment शुरू करने के लिए--एक space (या control character) के साथ चाहिए। - एक block comment पर closing
*/भूल जाना, ताकि script का बाकी हिस्सा comment हो जाए। - किसी
;से पहले एक comment इस तरह रखना कि statement का हिस्सा छुप जाए, जैसेSELECT 1 -- ;।
- MySQL एक relational database management system है जो data को tables में store करता है और इसके साथ काम करने के लिए SQL इस्तेमाल करता है।
- MySQL install करना और Workbench या command line इस्तेमाल करना आपको SQL statements चलाने देता है।
- Comments और data types का एक overview MySQL code लिखने के लिए पहले building blocks हैं।
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: