- 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 6702 Articles for Database
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
11K+ Views
To check if the given value is a string or not ,we use the cast() function. If the value is not numeric then it returns 0, otherwise it will return the numeric value. In this way, we can check whether the value is an integer or not. Case 1 − Checking for a string with integers mysql> select cast('John123456' AS UNSIGNED); The following is the output. It shows that the value is not numeric, therefore 0 is returned. +--------------------------------+ | cast('John123456' AS UNSIGNED) | +--------------------------------+ | 0 | +--------------------------------+ 1 row in set, 1 warning (0.00 sec) ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
6K+ Views
To swap two columns, we can apply the below swapping logic. Add both values and store them into the first column Subtract the first column’s value from the second and store it into the second column. Subtract the first column’s value from the updated second column and store it into the first. The above rule structure is as follows. Suppose, the first column is a and the second column is b. 1. a = a+b; 2. b = a-b; 3. a = a-b; Now we will apply the above rule in order to swap the two ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
157 Views
Use the function CONVERT() or Regular Expression. The CONVERT() method converts a value from one datatype to another. This will ecnetually fetch digits for us. Let us see an example. Firstly, we will create a table. mysql> create table textIntoNumberDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.47 sec) Inserting some records. mysql> insert into textIntoNumberDemo values('John-11'); Query OK, 1 row affected (0.11 sec) mysql> insert into textIntoNumberDemo values('John-12'); Query OK, 1 row affected (0.17 sec) mysql> insert into textIntoNumberDemo values('John-2'); Query OK, 1 row affected (0.11 ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
8K+ Views
We can get the current time with the help of now() and adding 2 hours is done by giving the interval as 2. Firstly, collect information of the current time in the system with the help of now(). The current time is . The following is the query to get the current date and time. mysql> select now(); Here is the output. +---------------------+ | now() | +---------------------+ | 2018-11-01 12:58:40 | +---------------------+ 1 row in set (0.00 sec) To add 2 hours in the current time, we will use the DATE_ADD() function. mysql> select ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
3K+ Views
To create a temporary table in a SELECT statement we use TEMPORARY keyword. This temporary table will be visible for the current session and whenever a session is closed, it is automatically destroyed. Two sessions can use the same temporary table. Creating a table. mysql> create table MyTableDemo -> ( -> id int, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.69 sec) Inserting some records. mysql> insert into MyTableDemo values(1, 'John'); Query OK, 1 row affected (0.18 sec) mysql> insert into MyTableDemo values(2, 'Carol'); Query OK, 1 row affected (0.13 ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
2K+ Views
The ibdata1 file cannot shrink, it is a particularly troublesome feature of MySQL. The ibdata1 file can be shrinked if you delete all databases, remove the files and reload the mysqldump. We can configure MySQL so that each table, including its indexes, is stored as a separate file. It is enabled by default as of version 5.6.6 of MySQL. To setup our server to use separate files for each table, we need to change my.cnf in order to enable it. If your MySQL version is below 5.6.6, then you need to add it in my.cnf file. [mysqld] ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
4K+ Views
To check what character set a MySQL database/ table/ column is, let us see an example: A database which has the name ‘business’ and table name is ‘student’ which is already present in the database is used. Syntax in order to check the table character set. SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = "yourDatabaseName" AND T.table_name = "yourTableName"; Applying the above syntax to display character set for table student. mysql> SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, -> information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA -> WHERE CCSA.collation_name = T.table_collation -> ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
3K+ Views
As the name “SHA256” suggest, it is 256 bits long. If we are using hexadecimal notation then digit codes represent 4 bits. In order to represent 256, we need 256/4 = 64 bits. We need a data type varchar(64) or char(64). Creating a table for our example. mysql> create table SHA256Demo -> ( -> Password varchar(64) -> ); Query OK, 0 rows affected (0.54 sec) Inserting records into table. mysql> insert into SHA256Demo values(' 4e2e1a39dba84a0b5a91043bb0e4dbef23970837'); Query OK, 1 row affected (0.18 sec) Displaying all records. mysql> select *From SHA256Demo; The following ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
162 Views
We can use a conditional clause called the WHERE Clause to filter out the results. Using this WHERE clause, we can specify a selection criteria to select the required records from a table. The HAVING clause specify filter conditions for a group of rows or aggregates WHERE clause cannot be used with aggregate function while HAVING can be used with aggregate function. The following is an example − Let us now create a table. mysql> create table WhereDemo -> ( -> Price int -> ); Query OK, 0 rows affected (0.64 sec) Inserting records into table. ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
5K+ Views
The hashed password data type depends upon which hashing algorithm we are using. The hashing algorithm does not depends upon the input size because it produces a result of the same length. It gives the result in a series of hexadecimal digits, and we can reduce the hexadecimal digits by half with the help of UNHEX() function. There are various algorithms and data types to store values. MD5 − It can use char(32) or BINARY(16). SHA-1 − It can use data type char(40) or BINARY(20). Example of MD5 The following is an example − mysql> select MD5('This ... Read More