SQL Alias

What is SQL false name? Here, we will figure out how we can characterize false names of table, segment in SQL? What is the reasons for assumed names and what is the benefits of SQL?

SQL Aliases:

  • False names implies elective name.
  • We can characterize SQL false names utilizing ‘as’ proviso.
  • SQL nom de plumes can be utilized to give a transitory name.
  • Reason for SQL assumed names is to improve meaningfulness.
  • We can actualize SQL assumed names for table or section.

Syntax for table:

SELECT column_name FROM table_name as alias_name;

Syntax for column:

SELECT column_name as alias_name  
FROM table_name;

Example: Alias for column name:

Table records

    Full_name
    Anny Sharma
    Ayesha Sharma
    Preeti jain
    Rahul jain

Query

mysql> SELECT full_name as name FROM emp;

Output

    Name
    Anny Sharma
    Ayesha Sharma
    Preeti jain
    Rahul jain

Example: Alias for table name

Table

    Id	Full_name
    3	Anny sharma
    4	Ayesha jain
    5	Preeti jain
    6	Rahul jain

Query

mysql> SELECT * FROM emp as e where e.id = 4;

Output

    Id	Full_name
    4	Ayesha jain

Leave a Comment

error: Alert: Content is protected!!