Govinda Sai has Published 74 Articles

How can SELECT, without reference to any table, be used to calculate expression in MySQL?

Govinda Sai

Govinda Sai

Updated on 22-Jun-2020 11:49:51

54 Views

With the help of following MySQL statement, we can use SELECT to calculate the expression −SELECT expression;The above statement is having no reference to any table. Followings are some examples −mysql> Select 10 DIV 5; +----------+ | 10 DIV 5 | +----------+ |        2 | +----------+ 1 ... Read More

How does MySQL determine the end of the statement?

Govinda Sai

Govinda Sai

Updated on 22-Jun-2020 11:06:30

59 Views

MySQL determines the end of a statement when it encounters any one of the followings −Semicolon(;)Generally, MySQL determines the end of the statement, single-line or multiple-line, when it encounters the termination semicolon(;). Consider the examples below, mysql> Select * from employee; (Single line statement) mysql> Select *     -> ... Read More

How can I create a stored procedure to delete values from a MySQL table?

Govinda Sai

Govinda Sai

Updated on 22-Jun-2020 05:38:01

3K+ Views

We can create a stored procedure with IN operator to delete values from a MySQL table. To make it understand we are taking an example of a table named ‘student_info’ having the following data −mysql> Select * from student_info; +------+---------+------------+------------+ | id   | Name    | Address    | ... Read More

How can we find out the storage engine used for a particular table in MySQL?

Govinda Sai

Govinda Sai

Updated on 20-Jun-2020 13:48:16

58 Views

The following MySQL statement can find out the storage engine used for ‘Student’ table in database named ‘tutorial’ −mysql> SELECT ENGINE FROM information_schema.TABLES   -> WHERE TABLE_SCHEMA = 'tutorial'   -> AND TABLE_NAME = 'Student'; +--------+ | ENGINE | +--------+ | MyISAM | +--------+ 1 row in set (0.13 sec)

In MySQL, how CEILING() and FLOOR() functions are different from ROUND() function?

Govinda Sai

Govinda Sai

Updated on 20-Jun-2020 13:12:04

6K+ Views

The CEILING() function returns the smallest integer value that is not smaller than X. Consider the following example –mysql> Select CEILING(3.46); +---------------+ | CEILING(3.46) | +---------------+ |             4 | +---------------+ 1 row in set (0.00 sec)   mysql> Select CEILING(-6.43); +----------------+ | CEILING(-6.43) ... Read More

In MySQL, how to raise a number to the power of another number?

Govinda Sai

Govinda Sai

Updated on 20-Jun-2020 13:09:47

198 Views

POWER() function is used to raise a number to the power of another number. POW() is the synonym of POWER() function. In these functions, the first arguments work as the base and the second argument works as the exponent. SyntaxPOWER(M, N)  Here,  M is the number which is the base of ... Read More

How can we change MySQL user password by using the SET PASSWORD statement?

Govinda Sai

Govinda Sai

Updated on 20-Jun-2020 11:42:26

223 Views

We can use SET PASSWORD statement to change the password. Before using this command, we need to have at least UPDATE privileges. Its syntax would be as follows −SyntaxSET PASSWORD FOR ‘user_name@host_name’=new_password;Here, New_password would be new password we want to set for MySQL userUser_name is the name of the current ... Read More

How does MySQL handle overflow during numeric expression assessment?

Govinda Sai

Govinda Sai

Updated on 20-Jun-2020 07:50:48

165 Views

As we know that MySQL will produce an error if overflow occurs during the assessment of numeric expressions. For example, the largest signed BIGNT is 9223372036854775807, so the following expression will produce an error −mysql> Select 9223372036854775807 + 1; ERROR 1690 (22003): BIGINT value is out of range in '(9223372036854775807+1)'MySQL ... Read More

How can we remove composite PRIMARY KEY constraint applied on multiple columns of an existing MySQL table?

Govinda Sai

Govinda Sai

Updated on 19-Jun-2020 11:56:51

3K+ Views

We can remove composite PRIMARY KEY constraint from multiple columns of an existing table by using DROP keyword along with ALTER TABLE statement.ExampleSuppose we have a table ‘Room_allotment’ having a composite PRIMARY KEY constraint on columns ‘ID’ and ‘RoomNo’ as follows −mysql> describe room_allotment; +--------+-------------+------+-----+---------+-------+ | Field  | Type   ... Read More

How to call a JavaScript function on click?

Govinda Sai

Govinda Sai

Updated on 19-Jun-2020 11:23:44

1K+ Views

To call a function on click of a button in JavaScript, use onclick. Try to run the following code to call a function onclick in JavaScript −Example                    function sayHello() {             document.write ("Hello there!");   ... Read More

Advertisements