mysql alias column name example & sql command

mysql alias column name example and sql command

mysql-alias-column-name-example.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>mysql alias column name example and sql command</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="mysql alias column name example and sql command">
  <meta name="keywords" content="php, example, code, table, sql command, sql, mysql alias column name">
  <meta name="description" content="mysql alias column name example and sql command">
  <style>
   h2, h4{background:#ddd; color:#000095;}
   h2{ padding:3px; margin:3px; font-size:21px;}
   h4{ padding:2px; margin:2px; font-size:18px;}
   p{padding:2px; margin:2px; color:#0099FE;}
   body{ background:#FFFFFD;}
  </style>
 </head>
 <body>
  <h2>mysql alias column name example and sql command</h2>
  <pre>
   <?php
    /*
     ------------------------------------------------------------------------------------
     WE WANT TO SELECT LastName, MonthlySalary and annual salary + a bonus of 700 of all
     employees of the HR database by using sql command where annual salary + a bonus of 700
     as AnnualSalary
     ------------------------------------------------------------------------------------
    */
    $sql = " SELECT LastName, MonthlySalary, 12*MonthlySalary + 700 AS AnnualSalary FROM employees ";
    /*
     ---------------------------------------------------------------------------------------------
     by using AS keyword we can define an alias to rename the column name or column name heading
     alias is case sensitive
     ---------------------------------------------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>

mysql alias column name example and sql command - output in the client

No comments:

Post a Comment

leave your comments here..