...

Database Managment - MySql

Back to Course

Lesson Description


Lession - #1325 SQL Joins



SQL Joins

Aliases are temporary names assigned to tables or columns for the sake of a certain SQL query. It is used when the name of a column or table is changed from its original name, but the change is just temporary.
  • Aliases are used to make table or column names easier to read.

  • The renaming is only a temporary alteration, and the table name in the original database remains unchanged.

  • When table or column names are long or difficult to understand, aliases come in handy.

  • These are preferred when a query involves more than one table.

Using the % operator to format.

The format(>
string method is used to format the data.

f-strings are string literals that are used to format data.

String Template Class Formatting

So we'll look at all of the methods described above, as well as which string formatting style is the best.



Using the % operator to format a string

It's the most traditional way to format strings. The modulo percent operator is used here. The "string-formatting operator" is another name for the modulo percent.

Example: Injecting multiple strings using % operator

x = 'looked'
 
print("Avinash %s and %s around"%('walked',x>
>


Output:
Avinash walked and looked around.


‘%s’ is used to inject strings similarly ‘%d’ for integers, ‘%f’ for floating-point values, ‘%b’ for binary format. For all formats, conversion methods visit the official documentation.

Example:

print('Joe stood up and %s to the crowd.' %'spoke'>
print('There are %d dogs.' %4>


Output:

Joe stood up and spoke to the crowd.
There are 4 dogs.
Might I at any point utilize MySQL on Mac? MySQL for macOS is accessible in various structures: Native Package Installer, which utilizes the local macOS installer (DMG>
to walk you through the establishment of MySQL mysql mac mysql mac install mysql for mac.