Found 4381 Articles for MySQL

What are the similarities and differences between MySQL ORD() and ASCII() functions?

Monica Mona
Updated on 07-Feb-2020 06:41:57

384 Views

MySQL ORD() function returns the code for the leftmost character if that character is a multi-byte i.e. sequence of one or more bytes, with the help of the following formula(1st bytecode) + (2nd bytecode * 256) + (3rd bytecode * 256^2)On the other hand, ASCII() function returns the ASCII value of the leftmost character of a given string.The difference between them lies on the point that whether the leftmost character is a multi-byte character or not. If it is not a multi-byte character then both ORD() and ASCII() functions return similar results. Following example will demonstrate it.mysql> Select ORD('Tutorialspoint'); +-----------------------+ ... Read More

How can we take a backup of a particular table from a database by using mysqldump client program?

Jennifer Nicholas
Updated on 07-Feb-2020 06:42:55

244 Views

By using mysql dump client program we can take the backup of a particular table from the databases into a file having the extension ‘.sql’. It can be understood with the help of the following example −ExampleIn this example, with the help of mysql dump client program, we are taking the backup of a table named ‘student_info’ from ‘query’ database in a file named ‘student_info.sql’. The following command will do this:C:\mysql\bin>mysqldump -u root query student_info > student_info.sqlThe above command will create a file named student_info.sql which has the dump information of a file named ‘student_info’ from database named ‘query’.Read More

How can I restore a file created by mysqldump?

Sreemaha
Updated on 20-Jun-2020 10:39:45

175 Views

Suppose if we want to restore a file that has been created by mysqldump then we can restore in an existing database or in a new database after creating it. Then with the help of SOURCE statement, we can restore it. We can illustrate it by an example:ExampleIn this example, we are restoring the table named student_info.sql which has been dumped. It was basically in the database name ‘query’. Now we will restore it into a database named ‘tutorials’.mysql> Use Tutorials; Database changed mysql> SOURCE student_info.sql; Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected ... Read More

In MySQL, how can we check whether a string of a specified pattern is not present within another string?

Ankith Reddy
Updated on 07-Feb-2020 06:45:36

147 Views

We can check whether a string of specified pattern is not present within another string by using NOT LIKE operator along with wildcard characters.SyntaxNOT LIKE specific_patternSpecific_pattern is the pattern of string we do not want to find out within another string.ExampleSuppose we have a table named ‘student’ having names of the students and we want to get the details of all those students which are not having a pattern of string ‘av’ within their names. It can be done with the help of following MySQL query:mysql> Select * from Student WHERE name NOT LIKE '%av%'; +------+---------+---------+----------+--------------------+ | Id   ... Read More

What are the different wildcard characters which can be used with NOT LIKE operator?

Jai Janardhan
Updated on 07-Feb-2020 06:48:02

174 Views

As we know that NOT LIKE operator is used along with WILDCARD characters for not getting the string having specified string. Basically, WILDCARD is the characters that help search data matching complex criteria. Followings are the types of wildcard which can be used in conjunction with NOT LIKE operator:% - The PercentageThe ‘%’ wildcard is used to specify a pattern of 0, 1 or more characters. A basic syntax for using % wildcard with NOT LIKE operator is as follows:Select Statement…Where column_name NOT LIKE ‘X%’Here X is any specified starting pattern such as the single character of more and % matches ... Read More

What is the significant difference between MySQL LIKE and equal to (=) operator?

Sharon Christine
Updated on 07-Feb-2020 06:49:34

4K+ Views

We have seen the MySQL SELECT command to fetch data from the MySQL table. We can also use a conditional clause called as the WHERE clause to select the required records.A WHERE clause with the ‘equal to’ sign (=) works fine where we want to do an exact match. Like if "tutorial_author = 'Sanjay'". But there may be a requirement where we want to filter out all the results where the tutorial_author name should contain "jay". This can be handled using MySQL LIKE operator along with the WHERE clause.If the MySQL LIKE operator is used without a wildcard character, the ... Read More

How can we take a backup of multiple databases by using mysqldump client program?

Vrundesha Joshi
Updated on 20-Jun-2020 10:40:35

3K+ Views

By using mysql dump client program we can take the backup of multiple databases into a file having the extension ‘.sql’. It can be understood with the help of the following example −ExampleIn this example, with the help of mysql dump client program, we are taking the backup of two databases named ‘tutorials’ and ‘query1’ in a file named ‘tutorials_query1.sql’. The following command will do this −C:\mysql\bin>mysqldump -u root --databases tutorials query1 > tutorials_query1.sqlThe above command will create a file named tutorials_query1.sql which have the dump information of both the databases named tutorials and query1.Read More

How can we take a backup of the single database by using mysqldump client program?

varma
Updated on 20-Jun-2020 10:41:02

172 Views

By using mysqldump client program we can take the backup of a database into a file having the extension ‘.sql’. it can be understood with the help of following example −ExampleIn this example, with the help of mysqldump client program, we are taking the backup of a database named ‘tutorials’ in a file named ‘tutorials.sql’. The following command will do this −C:\mysql\bin>mysqldump -u root tutorials > tutorials.sqlThe above command will create a file named ‘turorials.sql’ in the bin folder of MySQL. This file will contain drop table, create a table and insert command for all the tables in the tutorials ... Read More

How can we extract a substring from the value of a column in MySQL table?

Manikanth Mani
Updated on 07-Feb-2020 05:51:23

923 Views

We can apply any of the functions like SUBSTRING(), MID() or SUBSTR() to extract a substring from the value of a column. In this case, we must have to provide the name of the column as the first argument of the function i.e. at the place of string we have to give the name of the column. Following example will demonstrate it.ExampleSuppose we want to extract a substring from the ‘Name’ column of ‘Student’ table then it can be done by using the different functions as follows −mysql> Select name, SUBSTR(name, 2, 4) from student; +---------+------------------+ | name    | ... Read More

In what cases, we cannot use MySQL TRIM() function?

Arjun Thakur
Updated on 20-Jun-2020 10:35:51

566 Views

Actually for using MySQL TRIM() function we must have to know the string which we want to trim from the original string. This becomes the major drawback of TRIM() in the cases where we want to trim the strings having different values. For example, suppose we want to get the output after trimming the last two characters from the strings but every string is having different characters at last two places.Examplemysql> Select * from Employee; +------+----------------+------------+-----------------+ | Id   | Name           | Address    | Department      | +------+----------------+------------+-----------------+ | 100  | Raman ... Read More

Advertisements