Chandu yadav has Published 1163 Articles

BOOLEAN or TINYINT to store values in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

493 Views

The MySQL BOOLEAN and BOOL both are equivalent to TINYINT(1). Whenever you create a column using BOOLEAN and BOOL data type, MySQL implicitly convert the BOOLEAN and BOOL to TINYINT(1). The BOOLEAN and BOOL are equivalents of TINYINT(1), since they are synonyms.Create a table using BOOLEAN data type. The query ... Read More

Does SQL Server have an equivalent to MySQL's ENUM data type?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

2K+ Views

This works in MySQL version 8.0.12. The syntax is as follows.create table yourTableName ( yourColumnName enum(‘Value1’, Value2’, Value3’, ......N) default Value1’ or Value2 or Value3, ..N );Set the enum type in MySQL with the following query.mysql> create table EnumInMySQL -> ( -> WebCRUD enum('CREATE', 'READ', 'UPDATE', 'DELETE') -> default 'CREATE' ... Read More

Grab where current date and the day before with MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

2K+ Views

You can grab the current date with CURDATE() and the day before with MySQL using DATE_SUB() with INTERVAL 1 DAY. The syntax is as follows:SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY);The syntax is as follows to get curdate and the day before with date_sub().SELECT *FROM yourTableName WHERE yourColumnName = CURDATE() OR yourColumnName ... Read More

How can I stop a running MySQL query?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

505 Views

In order to stop a running MySQL query, we can use the KILL command with process id. The syntax is as follows −kill processId;Or you can stop a running MySQL query with the help of below syntax −call mysql.rds_kill(queryId);Let us first get the processId with the help of show command. ... Read More

Update MySQL date and increment by one Year?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

914 Views

You can use in-built function date_add() from MySQL. The syntax is as follows −UPDATE yourTableName SET yourDateColumnName=DATE_ADD(yourDateColumnName, interval 1 year);To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table UpdateDate -> ( ... Read More

MySQL date format to convert dd.mm.yy to YYYY-MM-DD?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

18K+ Views

Use STR_TO_DATE() method from MySQL to convert. The syntax is as follows wherein we are using format specifiers. The format specifiers begin with %.SELECT STR_TO_DATE(yourDateColumnName, '%d.%m.%Y') as anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows.mysql> create table ... Read More

Truncate with condition in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

1K+ Views

In MySQL, there is no way to truncate with condition. You cannot use truncate statement with where clause.If you want the condition, use delete command −DELETE FROM yourTableName WHERE youCondition;The above syntax is fine but if you want a faster solution, then DELETE is not good in comparison to Truncate. ... Read More

Can an Android Toast be longer than Toast.LENGTH_LONG?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

152 Views

Sometimes we need to display more time then LENGTH_LONG. This example demonstrates how to show toast longer than Toast.LENGTH_LONG.Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 - Add the following code ... Read More

MySQL create user if it does not exist?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

945 Views

You can create user if it does not exist with the help of “create user” command. The command will work on MySQL version 5.7.6 and above. The syntax is as follows −mysql> CREATE USER IF NOT EXISTS 'yourUserName'@'localhost' IDENTIFIED BY 'yourPassword';Apply the above syntax to create a user if it ... Read More

How to find MySQL my.cnf on my windows computer?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:24

2K+ Views

To find my.cnf on Windows system, first open the command prompt with the help of shortcut key Windows + R (run). The snapshot is as follows −Type “services.msc” on command prompt and press ENTER as shown in the following screenshot −Now, a new wizard will open. The snapshot is as ... Read More

Advertisements