SQL - Aliases in Hindi




SQL aliases का उपयोग टेबल, या तालिका में एक स्तंभ, एक अस्थायी नाम देने के लिए किया जाता है। Aliases को अक्सर column नामों को और अधिक पठनीय बनाने के लिए उपयोग किया जाता है। एक alias केवल क्वेरी की अवधि के लिए मौजूद है।

Alias Column Syntax

SELECT column_name AS alias_name
FROM table_name;

Alias Table Syntax

SELECT column_name(s)
FROM table_name AS alias_name;

Aliases एक विशेष SQL क्वेरी के उद्देश्य के लिए तालिका या कॉलम को दिए गए अस्थायी नाम हैं। इसका उपयोग तब किया जाता है जब कॉलम या तालिका का नाम उनके मूल नामों के अलावा उपयोग किया जाता है, लेकिन संशोधित नाम केवल अस्थायी है।

  • टेबल या कॉलम names को और अधिक पठनीय बनाने के लिए Aliases को बनाते हैं।

  • नामकरण केवल एक अस्थायी परिवर्तन है और मूल डेटाबेस में तालिका का नाम नहीं बदलता है।

  • Aliases तब उपयोगी होते हैं जब टेबल या कॉलम नाम बड़े होते हैं या बहुत पठनीय नहीं होते हैं।

Basic Syntax

For column alias:

SELECT column as alias_name FROM table_name;
column: fields in the table
alias_name: temporary alias name to be used in replacement of original column name 
table_name: name of table

For table alias:

SELECT column FROM table_name as alias_name;
column: fields in the table 
table_name: name of table
alias_name: temporary alias name to be used in replacement of original table name