- 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
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
702 Views
MySQL defines NCHAR as a way to indicate that a CHAR column should use predefined character set. Utf8 is used by MySQL as its predefined character set.ExampleIn the example below, we are creating a table named ‘Student1’. In this table, we are declaring the data types of three columns with three different declaration styles which are rather equivalent of each other. It is all due to NCHAR.mysql> Create table Student1(Name Char(10) character set utf8, Address NATIONAL CHARACTER(10), FatherName NCHAR(10)); Query OK, 0 rows affected (0.25 sec)Now on checking the status of table, with the help of query below, we ... Read More
![Sravani S](https://www.tutorialspoint.com/assets/profiles/13538/profile/60_67753-1512711355.jpg)
143 Views
On specifying a CHARACTER SET binary attribute for a character string data type, MySQL creates that column as its subsequent binary string type. The conversions for CHAR, VARCHAR and BLOB data types take place as follows −CHAR would become BINARYVARCHAR would become VARBINARYTEXT would become BLOBThe above kind of conversion does not occur for ENUM and SET data type and they both are created as declared while creating the table.ExampleIn the example below we have created a table named ‘EMP’ with four columns all specified as CHARACTER SET binary as follows −mysql> Create table Emp(Name varchar(10) CHARACTER SET binary, Address ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
100 Views
With the help of the following MySQL query we can check the character sets of all the tables in a particular database −mysql> Select Column_name, TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';ExampleFor example, the query below returns the character sets of all the tables along with the column names in a database named ‘Alpha’.mysql> Select Column_name 'Column', TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha'; +---------+------------+--------------------+ | Column | TABLE_NAME | CHARACTER_SET_NAME | +---------+------------+--------------------+ | Name | employee | latin1 | | email | employee ... Read More
![V Jyothi](https://www.tutorialspoint.com/assets/profiles/13530/profile/60_77592-1512648869.jpg)
2K+ Views
With the help of the following MySQL query we can check the character sets of all the tables in a particular database −mysql> Select TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';ExampleFor example, the query below returns the character sets of all the tables in a database named ‘Alpha’.mysql> Select TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha'; +------------+--------------------+ | TABLE_NAME | CHARACTER_SET_NAME | +------------+--------------------+ | employee | latin1 | | employee | latin1 | | student | latin1 ... Read More
![Lakshmi Srinivas](https://www.tutorialspoint.com/assets/profiles/13528/profile/60_91717-1512651120.jpg)
6K+ Views
We can use DELETE statement along with a WHERE clause, which identifies those multiple rows, to delete multiple rows from MySQL table.Examplemysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 5 | Ram | +------+-----------+ 4 rows in set (0.00 sec) mysql> DELETE from names WHERE id > 2; Query OK, 2 rows affected (0.04 sec)The query above will delete multiple rows because WHERE clause identify two rows having id > 2 from table ‘names’.mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | +------+-----------+ 2 rows in set (0.00 sec)
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
376 Views
Following is the query to check character set of the columns of MySQL table −mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM information_schema.columns where table_schema = 'db_name' and table_name ='table_name';ExampleFor example, the query below returns the name of the columns of ‘test_char_set’ table in a database named ‘sample’ along with the character sets of those columns.mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM information_schema.columns where table_schema = 'Sample' and table_name ='test_char_set'; +--------+---------+ | Column | Charset | +--------+---------+ | Name | latin1 | | Field | latin1 | ... Read More
![Priya Pallavi](https://www.tutorialspoint.com/assets/profiles/13562/profile/60_91320-1512544134.jpg)
102 Views
Following is the query to check default character set of the particular MySQL database −mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'db_name';ExampleFor example, the query below will return the default character set of a database named ‘Sample’ −mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'Sample'; +----------------+---------+ | DatabaseName | Charset | +----------------+---------+ | Sample | latin1 | +----------------+---------+ 1 row in set (0.00 sec)
![Nikitha N](https://www.tutorialspoint.com/assets/profiles/13558/profile/60_76068-1512713229.jpg)
66 Views
The query below will return the name of the database along with the default character set −mysql> SELECT SCHEMA_NAME 'Database', default_character_set_name 'charset' FROM information_schema.SCHEMATA; +--------------------+---------+ | Database | Charset | +--------------------+---------+ | information_schema | utf8 | | gaurav | latin1 | | menagerie | latin1 | | mysql | latin1 | | performance_schema | utf8 | | sample | latin1 | | test | latin1 | | tutorial | latin1 | +--------------------+---------+ 8 rows in set (0.00 sec)
![Akshaya Akki](https://www.tutorialspoint.com/assets/profiles/13526/profile/60_48621-1512703980.jpg)
285 Views
We can use DELETE statement along with a WHERE clause, which identifies that particular row, to delete a row from MySQL table.Examplemysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 4 | Aarav | | 5 | Ram | +------+-----------+ 5 rows in set (0.00 sec) mysql> DELETE from names where id = 4; Query OK, 1 row affected (0.07 sec)The query above will delete a single row having id = 4 from table ‘names’.mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 5 | Ram | +------+-----------+ 4 rows in set (0.00 sec)
![Vikyath Ram](https://www.tutorialspoint.com/assets/profiles/13780/profile/60_74413-1512648006.jpg)
198 Views
With the help of DISTINCT keyword in SELECT statement, we can get the unique rows in MySQL result set.Examplemysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 4 | Aarav | | 5 | Ram | | 5 | Ram | | 5 | Ram | +------+-----------+ 7 rows in set (0.00 sec)As we can see that table ‘names’ is having three duplicate rows, with the help of following query we can get the result set having only unique rows.mysql> Select DISTINCT * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 4 | Aarav | | 5 | Ram | +------+-----------+ 5 rows in set (0.00 sec)