
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 6705 Articles for Database

253 Views
Actually, MySQL evaluates an empty hexadecimal value to a zero-length binary string. It can be demonstrated as follows −mysql> Select CHARSET(X''); +--------------+ | CHARSET(X'') | +--------------+ | binary | +--------------+ 1 row in set (0.00 sec)The above result set shows that the empty hexadecimal value is a binary string. And the result set below shows that it is of length 0.mysql> Select LENGTH(X''); +-------------+ | LENGTH(X'') | +-------------+ | 0 | +-------------+ 1 row in set (0.00 sec)

179 Views
MySQL returns NULL if we provide any non-hexadecimal number as an argument to UNHEX() function. Following example will demonstrate it.Examplemysql> Select UNHEX('ANK96598'); +-------------------+ | UNHEX('ANK96598') | +-------------------+ | NULL | +-------------------+ 1 row in set (0.00 sec)As we know that the valid hexadecimal digits are between ‘0…9’, ‘A…F’ or ‘a…f’ hence the above query returns NULL.

2K+ Views
MySQL TRIM() function is used to remove all the suffixes or prefixes or both from the string. The working of TRIM() function can be understood with the help of its syntax −SyntaxTRIM([{BOTH | LEADING | TRAILING} [str_to_remove] FROM] string)Here, the argument BOTH means the prefixes from both left and right to be removed from the string.LEADING argument means that only leading prefixes to be removed.TRAILING argument means that only trailing prefixes to be removed.Str_to_remove is the argument which means the string we want to remove from the string.String argument means the string from which the prefixes have to be removed.Examplemysql> ... Read More

197 Views
The syntax of SUBSTRING() function using FROM and FOR keywords is the standard MySQL syntax.SyntaxSUBSTRING(str FROM pos FOR len)Here, str is the string from which substring would be returned.Pos is the starting position of substring.Len is the length of substring i.e. the total number of characters fetched from str.Examplemysql> Select SUBSTRING('foobarbar' FROM 4 FOR 5); +-------------------------------------+ | SUBSTRING('foobarbar' FROM 4 FOR 5) | +-------------------------------------+ | barba | +-------------------------------------+ 1 row in set (0.00 sec)The result set above, makes the use of FROM and FOR keywords very much clear in SUBSTRING() function.

425 Views
If we omit the hostname part of the user account, MySQL will accept it and allow the user to connect from any host. Its syntax would be as follows −Use mysql; CREATE USER user_name IDENTIFIED BY password;Here, user_name is the name of the user we wish to take account of.Password is the password we wish to make for user_account. With the help of this password, MySQL server will identify this user.ExampleIn the given example we are creating a user ‘REMOTE’ by omitting the host name.mysql> CREATE USER remote identified by 'password123'; Query OK, 0 rows affected (0.00 sec)The user ‘Remote’ can ... Read More

288 Views
To make it understand, we are using the following data from a table named ‘customerdetail’.mysql> Select * from Customerdetail; +----------------------+----------------------+----------+---------------------+ | Name | FName | Address | Emailid | +----------------------+----------------------+----------+---------------------+ | Advik Jhamb | Lovkesh Jhamb | Mumbai | Advik@gmail.com | | Chirag Jai Patil | Raman Jai Patil | Gujrat | chirahp@yahoo.com | | Devansh Singh Rajput | Kishore Singh Rajput | ... Read More

3K+ Views
It is quite possible to allow a user account to connect from any host. To do so we need to create the user with the help of ‘%’ wild card character after @ character. Its syntax would be as follows −Use mysql; CREATE USER user_name@’%’ IDENTIFIED BY password;Here user_name is the name of the user we wish to make an account for.Password is the password we wish to make for user_account. With the help of this password, MySQL server will identify this user.ExampleIn the given example we are creating a user ‘Gaurav’ by using ‘%’ character so that it can be ... Read More

306 Views
As we know that, MySQL database server is having the user table in MySQL database which is used to store the user accounts so by using MySQL database we can create user accounts in MySQL database server. There must be two things while creating the new user account, one is the username and other is the hostname which is after @ character. The syntax for creating the user account is as follows − Syntax Use mysql; CREATE USER user_account IDENTIFIED BY password; Here user_account is the name of the user we wish to take account of. It can ... Read More

259 Views
When we install MySQL server, a database named MySQL created automatically. This MySQL database contains five main grant tables with the help of which MySQL server can control the privileges of MySQL database server. These tables are as follows −user tableThis table contains user account and global privileges columns. MySQL uses the user table to either accept or reject a connection from a host. A privilege granted in the user table is effective to all databases on the MySQL server.db tableThis table contains database-level privileges. MySQL uses the db table to determine which database a user can access and from which host. ... Read More

300 Views
To make it understand, we are using the following data from a table named ‘customerdetail’.mysql> Select * from Customerdetail; +----------------------+----------------------+-----------+---------------------+ | Name | FName | Address | Emailid | +----------------------+----------------------+-----------+---------------------+ | Advik Jhamb | Lovkesh Jhamb | Mumbai | Advik@gmail.com | | Chirag Jai Patil | Raman Jai Patil | Gujrat | chirahp@yahoo.com | | Devansh Singh Rajput | Kishore Singh Rajput ... Read More