AmitDiwan has Published 10744 Articles

How can I install or enable innoDB in MySQL?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:52:16

2K+ Views

In order to enable innoDB in MySQ, you need to work around my.ini file. However, in MySQL version 8, the default storage engine is innoDB. Check the same from my.ini file −You can even set this at the time of table creation −mysql> create table DemoTable    (    StudentId ... Read More

HTML DOM Input Radio value Property

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:48:05

192 Views

The HTML DOM Input radio value property is associated with the input element having type=”radio” and the value attribute. It is used to return the value of radio button value attribute or to set it.The value property for radio button doesn’t affect the user interface of the website as the ... Read More

HTML DOM Input Radio type property

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:43:33

190 Views

The HTML DOM Input radio type property is associated with the input element having its type=”radio”. It will always return radio for the input radio element.SyntaxFollowing is the syntax for radio type property −radioObject.typeExampleLet us look at an example for the radio type property − Live Demo Input radio ... Read More

Get at least x number of rows in MySQL?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:39:50

180 Views

To get at least x number of rows, you need to use the LIMIT clause. Following is the syntax −select *from yourTableName order by yourColumnName DESC limit yourXNumberOfRows;Let us first create a table −mysql> create table DemoTable (    EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeName varchar(100) ); Query ... Read More

Which is faster, a MySQL CASE statement or a PHP if statement?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:35:45

967 Views

The MySQL CASE statement is faster in comparison to PHP if statement. The PHP if statement takes too much time because it loads data and then process while CASE statement does not.Let us first create a table and work around an example of MySQL CASE statement −mysql> create table DemoTable ... Read More

MySQL query to select records approaching in next 12 hours?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:32:13

325 Views

For this, you can use INTERVAL 12 hour using DATE_ADD(). Let us first create a table −mysql> create table DemoTable (DueDateTime datetime); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-07-12 10:50:30'); Query OK, 1 row affected (0.29 sec) ... Read More

How to generate 5 random numbers in MySQL stored procedure?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:29:04

342 Views

To generate random numbers, use the ORDER BY RAND() function in MySQL. Let us first create a table −mysql> create table DemoTable (Value int); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(89); Query OK, 1 row affected (0.19 ... Read More

How to set different auto-increment ids for two tables with a user-defined variable?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:25:48

274 Views

For this, you can use LAST_INSERT_ID(). Let us first create a table. Here, we have set the auto_increment id to StudentId column −mysql> create table DemoTable1 (StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Is MySQL's SLEEP() function a busy-wait? How to implement it?

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:22:45

323 Views

No, MySQL sleep function is not busy-wait. Let us first create a table and implement the SLEEP() function −mysql> create table DemoTable(FirstName varchar(100)); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.15 sec) ... Read More

MySQL order by field using CASE Statement

AmitDiwan

AmitDiwan

Updated on 22-Aug-2019 11:17:21

835 Views

To order by field, use CASE statement. Let us first create a table −mysql> create table DemoTable(StudentId varchar(100)); Query OK, 0 rows affected (1.69 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('STU-980'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values('STU-1029'); ... Read More

Advertisements