- 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)
313 Views
To change the timezone in MySQL, we can use the SET command. The following is the syntax. SET time_zone=’someValue’; Let us now use the above syntax and apply it in the below query. mysql > SET time_zone = '+8:00'; Query OK, 0 rows affected (0.00 sec) Above, the time_zone is changed by a value equivalent to 8. To change the timezone globally, use the GLOBAL command. Here is the syntax. SET GLOBAL time_zone = 'someValue'; Here is an example. mysql> SET GLOBAL time_zone = '+8:00'; Query OK, 0 rows affected (0.00 sec) The above query will change the timezone globally.
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
7K+ Views
Firstly, check the MySQL database with DESC command. mysql>DESC mysql.db; The following is the output. +-----------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+---------------+------+-----+---------+-------+ | Host | char(60) | NO | PRI | | ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
203 Views
To work with MySQL pagination, firstly let us see how to use CREATE command and use it to create a table. mysql>CREATE table RowCountDemo -> ( -> ID int, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.95 sec) Records are inserted with the help of INSERT command. mysql>INSERT into RowCountDemo values(1, 'Larry'); Query OK, 1 row affected (0.15 sec) mysql>INSERT into RowCountDemo values(2, 'John'); Query OK, 1 row affected (0.13 sec) mysql>INSERT into RowCountDemo values(3, 'Bela'); Query OK, 1 row ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
2K+ Views
MySQL has introduced signals similar to an exception in other languages. Let us first see the syntax of signal. SIGNAL SQLSTATE ' PredefinedValueforSignalError' SET MESSAGE_TEXT = 'AnyMessageInformation'; Above, we have set our own error message text as well. We will apply the above query to get an error message with the help of signals. mysql > SIGNAL SQLSTATE '42927' SET MESSAGE_TEXT = 'Error Generated'; The following is the output of the above query. ERROR 1644 (42927): Error Generated In the above output, ‘42927’ is a SQLSTATE and ‘Error Generated’ is an error message, which we added.
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
1K+ Views
Let us first see an example to create a table, add records and display them. The CREATE command is used to create a table.mysql> CREATE table RowCountDemo -> ( -> ID int, -> Name varchar(100) > ); Query OK, 0 rows affected (0.95 sec)Records are inserted with the INSERT command.mysql>INSERT into RowCountDemo values(1, 'Larry'); Query OK, 1 row affected (0.15 sec) mysql>INSERT into RowCountDemo values(2, 'John'); Query OK, 1 row affected (0.13 sec) mysql>INSERT into RowCountDemo values(3, 'Bela'); Query OK, 1 row affected (0.15 sec) mysql>INSERT into RowCountDemo values(4, 'Jack'); Query OK, 1 row affected (0.11 sec) ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
310 Views
The choice depends upon the database. In ORACLE database, an empty string is converted to NULL.In MySQL, the usage of an empty string is better as compared to NULL. It is easy to check for an empty string with some boundary conditions, while this cannot be done with NULL. To find NULL, we need to add an extra condition i.e. ‘IS NULL’We can check that the length of NULL is 0 while length of empty string is 1.To check the length of NULL.mysql>SELECT count(NULL);The following is the output of the above query.+-----------------+ | count(NULL) | +-----------------+ ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
470 Views
We can escape single quotes with the help of the SELECT statement. For instance, when single quotes are encountered in a name, eg. “Carol’s”.Let us see the syntax.SELECT ‘SomeValue’;Here is an example that display how to include text with single quotes.mysql> SELECT 'Carol\'s Taylor.'; The following is the output.+-------------------+ | Carol's Taylor | +-------------------+ | Carol's Taylor | +-------------------+ 1 row in set (0.00 sec)
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
390 Views
Timestamp is a data type in MySQL and works for different time zone. It is also used for date and time purpose To understand the concept, we need to create a table.Creating a tablemysql> CREATE table TimeStampDemo -> ( -> MyDataTime timestamp -> ); Query OK, 0 rows affected (0.57 sec)After creating the table, we will insert a record with the help of INSERT command.Inserting recordsmysql> INSERT into TimeStampDemo values (now()); Query OK, 1 row affected (0.12 sec)After inserting a record, we can display the records with the help of SELECT statement.Displaying recordsmysql> SELECT * from TimeStampDemo; After executing the ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
130 Views
The shortcoming of mysql_real_escape_string is as follows − It has main shortcoming in the modern API while we are making prepared statement. This has another shortcoming for every possible attack when you will typecast. Let us see the typecast syntax in MySQL − (TypeCast)mysql_real_escape_string($_REQUEST['anyColumnName'])); In the above syntax, we are typecasting, but in this case, it is not safer for every possible attack. The other cases include the following − It is not type safe. It is not for injection attack.
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
860 Views
Yes, we can include a number for column name in MySQL. We need to use the symbol backtick, which is as follows( ` `)To understand, we will make a table with the help of CREATE command. Let us create a table −mysql> CREATE table NumberColumnDemo -> ( -> `123` varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)Above, I have created a column name as a number with the help of backtick symbol.Now, we can check the same by inserting records with the help of INSERT command. Let us insert a record, which is as follows −mysql> INSERT into ... Read More