×
Clear all filters including search bar
Valeri Tandilashvili's MySQL Notes
notes
tableTRUNCATE notes;
The same as the query above - deletes all rowsTRUNCATE TABLE notes;
Note: The two queries are aliases for each othernotes
with its contentDROP TABLE notes;
If the table does not exist, it will generate the following error:#1051 - Unknown table 'notes
Deletes several tables at the same timeDROP TABLE notes, students;
Deletes the table if exists, otherwise it will not generate an errorDROP TABLE IF EXISTS notes;
Note: There is no undo. Once we delete, the table is gone5
from 10
base system to 2
SELECT
CONV(5, 10, 2)
16
because 2
to the power of 4
is 16
SELECT
POWER(2, 4)
Note: POW
and POWER
are the aliases for the same command180
degrees converted to radians gives us PI
: 3.141592653589793
PI
: 3.141592653589793
radians converted to degrees gives us 180
degrees.SELECT
RADIANS(180),
DEGREES(3.141592653589793)
90
degrees converted to radians gives us half of PI
: 1.5707963267948966
.
180
degrees converted to radians gives us PI
: 3.141592653589793
.SELECT
RADIANS(90),
RADIANS(180)
3
SELECT
CEIL(2.3),
CEIL(2.8)
2
SELECT
FLOOR(2.3),
FLOOR(2.8)
2.3
will be rounded to 2 and the second 2.5
becomes 3SELECT
ROUND(2.3),
ROUND(2.5)
RPAD
appends string (third parameter) the specified number of times (second parameter) to the first parameter.
In this example each one of the student's last name that is less than 10 characters long, is filled with -
SELECT
RPAD(first_name, 10, '-') AS 'student name'
FROM students