Dino Geek, try to help you

How to use column aliases in MariaDB?


Column aliases in MariaDB are used to rename the columns in the output of your queries in an easier-to-understand way. The syntax for it is as follows:

```
SELECT column_name AS alias_name FROM table_name;
```

You can use the AS keyword to assign an alias to the column.

Here is an example:

Let’s say we have a table named Employees with the following data:

ID First_Name Last_Name
—- ————— ————-
1 John Doe
2 Jane Doe
3 Bob Smith

And you want to display the first name and last name of employees as ‘Employee First Name’ and ‘Employee Last Name’, then the SQL query would be:

```
SELECT First_Name AS ‘Employee First Name’, Last_Name AS ‘Employee Last Name’ FROM Employees;
```

This will output:

Employee First Name Employee Last Name
—————————- —————————
John Doe
Jane Doe
Bob Smith

Remarks:

- Aliases are useful when column names are long or not very meaningful.
- Aliases only exist for the duration of the query.
- You can also use aliases in the WHERE clause, but it is not supported by all SQL versions.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use