Tutorialspoint

How to make SQL case sensitive string comparison in MySQL?

Maheshwari Thakur
Answered on 18th Oct, 2018

Firstly, we will create a table with the help of CREATE command. Creating a table − mysql> CREATE table InCaseSensDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.50 sec) Inserting records into the table ... Read More

How can I search (case-insensitive) in a column using LIKE wildcard?

Ankith Reddy
Answered on 18th Oct, 2018

We can do this with the help of lower() with column name. Firstly, we will create a table with the help of CREATE command. Creating a table − mysql> CREATE table InCaseSensDemo -> ( -> Name varchar(100) -> ); Query ... Read More

SELECT DISTINCT vs GROUP BY in MySQL?

Chandu yadav
Answered on 18th Oct, 2018

SELECT DISTINCT can be used to give distinct values. Use it to remove duplicate records and it can be used with aggregate function as well. For example: MAX, AVG etc. This can be applied on a single column. Now, I am creating a table to use SELECT DISTINCT for a ... Read More

How to add a day to the date in MySQL?

George John
Answered on 18th Oct, 2018

To add 1 day, use date_add() function. Adding a day to datetime in MySQL gives the next day. The following is the syntax − SELECT DATE_ADD('Any date’', INTERVAL 1 DAY) AS AliasName; Now, I am applying the above query to add a day with date in MySQL. The ... Read More

How to enable MySQL Query Log?

Maheshwari Thakur
Answered on 18th Oct, 2018

To enable query log, use the command SET global. You cannot use set general_log in MySQL version 8.0.12 version. If you are using version 8.0.12, then you will get the below given error. Here, we are trying to set general_log to see what error will come − mysql> SET ... Read More

What is unsigned in MySQL?

George John
Answered on 18th Oct, 2018

Unsigned allows us to enter positive value; you cannot give any negative number. Let us create a table to understand unsigned in MySQL. To create a table, we will use the CREATE command. Let us create a table − mysql> CREATE table UnsignedDemo -> ( ... Read More

How do I get the current AUTO_INCREMENT value for a table in MySQL?

Chandu yadav
Answered on 18th Oct, 2018

To know the current auto_increment value, we can use the last_insert_id() function. Firstly, we will create a table with the help of INSERT command. Creating a table − mysql> CREATE table AutoIncrement -> ( -> IdAuto int auto_increment, -> primary ... Read More

How do I set the timezone of MySQL?

Ankith Reddy
Answered on 18th Oct, 2018

To know the current time, we can use the now() function with SELECT statement. The query is as follows − mysql> SELECT now(); After executing the above query, we will get the current time. The following is the output − +---------------------+ | now() ... Read More

How to use NULL in MySQL SELECT statement?

Maheshwari Thakur
Answered on 18th Oct, 2018

In MySQL, the length of NULL is 0. Here, we will see how NULL can be used with SELECT statement. Let us create a table with the help of CREATE command − Creating a table − mysql> CREATE table NullWIthSelect -> ( -> ... Read More

Difference between Schema and Database in MySQL?

George John
Answered on 18th Oct, 2018

In MySQL, schema is synonymous with database. As the query is written to create the database, similarly the query can be written to create the schema. Logical structure can be used by the schema to store data while memory component can be used by the database to store data. Also, ... Read More

How can I stop a running MySQL query?

Chandu yadav
Answered on 18th Oct, 2018

Before stopping a running query of MySQL, first we need to see how many processes are running with the help of show command. The query for that is given as follows − mysql> show processlist; After executing the above query, we will get the output with some id’s. ... Read More

How can I find non-ASCII characters in MySQL?

Ankith Reddy
Answered on 18th Oct, 2018

Non ASCII characters are characters such as the pound symbol(£), trademark symbol, plusminus symbol etc. To find the non-ASCII characters from the table, the following steps are required − First a table is created with the help of the create command which is given as follows − mysql> CREATE ... Read More

Which one is better to insert NULL or empty string in MySQL?

Maheshwari Thakur
Answered on 18th Oct, 2018

In innoDB, NULL occupies less space as compared to empty string. Also, the NULL length is null while length of the empty string is 0. To understand this, a table is created with the help of create command which is given as follows − mysql> CREATE table DemoEmptyAndNULL ... Read More

How do I check if a column is empty or null in MySQL?

George John
Answered on 18th Oct, 2018

To check if a column is empty or null , we can use the where clause with IS NULL and for empty we can use the condition ‘ ‘ i.e. empty space. The steps required for this are as folllows: First a table is created with the help of create ... Read More

Find records from one MySQL table which don't exist in another?

Chandu yadav
Answered on 18th Oct, 2018

To find the records from one MySQL table which don’t exist in another table we can use the subquery for the table which does not have the records. This can be better understood using the given steps − First a table is created using the create command. The table name ... Read More

Advertisements
Loading...
Unanswered Questions View All