- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4378 Articles for MySQL
857 Views
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 -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.62 sec)Above, I have created a table successfully. Now I will insert some records with the help of INSERT command −Inserting records −mysql> INSERT into NullWIthSelect values('John'); Query OK, 1 row affected (0.16 sec) mysql> INSERT into NullWIthSelect values('Bob'); Query OK, 1 row affected (0.12 sec) mysql> INSERT ... Read More
4K+ Views
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, a schema is collection of tables while a database is a collection of schema.To clarify this concept, a database and a schema are created. The steps for this are as follows −First, a database is created with the following syntax −create database yourDatabaseName;The above syntax is used in a query as ... Read More
911 Views
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. This is given as follows −+----+-----------------+-----------------+----------+---------+-------+------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-----------------+-----------------+----------+---------+-------+------------------------+------------------+ | 4 | event_scheduler | localhost | NULL | Daemon | 71034 | Waiting on empty queue | NULL | | 8 | Manish | localhost:53496 | business | Query | ... Read More
1K+ Views
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 table NonASciiDemo -> ( -> NonAScii varchar(100) -> ); Query OK, 0 rows affected (0.61 sec)After that the records are inserted into the table with the help of the insert command which is as follows −mysql> INSERT into NonASciiDemo values('-, -'); Query OK, 1 row affected (0.18 sec) mysql> INSERT into NonASciiDemo ... Read More
2K+ Views
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 -> ( -> Message varchar(100) -> ); Query OK, 0 rows affected (0.49 sec)After creating the table successfully, an empty record is inserted into the table with the help of insert command which is as follows −mysql> INSERT into DemoEmptyAndNULL values(' '); Query OK, 1 row affected (0.17 sec)After inserting the record, we can ... Read More
45K+ Views
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 command as follows −mysql> CREATE table ColumnValueNullDemo -> ( -> ColumnName varchar(100) -> ); Query OK, 0 rows affected (0.61 sec)An empty value is inserted into the table using INSERT command. This is given below −mysql> INSERT into ColumnValueNullDemo values(' '); Query OK, 1 row affected (0.14 sec)After that, the ... Read More
663 Views
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 is ‘PresentHistory’ and it has two columns. This is given as follows −mysql> CREATE table PresentHistory -> ( -> HisID int, -> HisName varchar(100) -> ); Query OK, 0 rows affected (0.54 sec)After creating the table, some records are inserted that will be present in the second table as well. This ... Read More
11K+ Views
In the system, the root is defined by another name as well as password. Then the user is created as a root with the help of the create command. This will result in the ERROR 1396. The query for this is given as follows − mysql> create user 'root'@'localhost' identified by 'root123'; After executing the above query, the following error is obtained − ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'localhost' The user can be created with another name and password successfully. This is given as follows − mysql> create user 'John'@'localhost' identified by ... Read More
6K+ Views
To find the port of the MySQL server, the command show can be used. Its syntax is as follows −show variables where variable_name=’port’;The above syntax is used to get the port number of the MySQL server using the following query −mysql> show variables where variable_name = 'port';After executing the above command, port of MySQL server is obtained as 3306. This can be seen in the following output −+---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3306 | +---------------+-------+ 1 row in set (0.01 sec)Alternatively, the system variable @@port can also be used to find ... Read More
4K+ Views
The MySQL version before 5.0.3 was capable of storing 255 characters but from the version 5.0.3 , it is capable of storing 65, 535 characters.MySQL official documentation states −The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65, 535 bytes, which is shared among all columns) and the character set used. For example, utf8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf8 character set can be declared to be a maximum of 21, 844 characters. Keep in mind that the limitation of ... Read More