Found 4219 Articles for MySQLi

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

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

87 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

3K+ 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

115 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

708 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

383 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

How can we extract a substring from a string in MySQL?

Samual Sam
Updated on 07-Feb-2020 05:55:34

405 Views

MySQL SUBSTRING() function can be used to extract a substring from a string. Basically SUBSTRING() returns a substring with a given length from a string starting at a specific position. It has various forms as follows −SUBSTRING(str, pos)SUBSTRING(str FROM pos)SUBSTRING(str, pos, len)SUBSTRING(str FROM pos FOR len)The forms without a len argument return a substring from string str starting at position pos. The forms with a len argument return a substring len characters long from string str, starting at position pos. The forms that use FROM are the standard MySQL syntax. It is also possible to use a negative value for ... Read More

What MySQL TRIM() function returns if 1st argument(i.e. BOTH, LEADING, TRAILING) is not specified?

Ayyan
Updated on 07-Feb-2020 05:56:07

49 Views

By default MySQL will assume the argument BOTH if the 1st argument is not specified in TRIM() function. Following example will demonstrate it.Examplemysql> SELECT TRIM('A' FROM 'ABCDAEFGAA'); +-----------------------------+ | TRIM('A' FROM 'ABCDAEFGAA') | +-----------------------------+ | BCDAEFG                     | +-----------------------------+ 1 row in set (0.00 sec)The above result set shows that when we did not specify 1st argument then MySQL returns the output by assuming BOTH as the 1st argument of TRIM() function.

What are some frequently used mysqlimport options while uploading the data into MySQL table through command line?

usharani
Updated on 27-Feb-2020 07:32:01

105 Views

mysqlimport can be run with a number of options. Followings are some options for mysqlimport and their effect on import.OptionAction-r or –replaceCause imported rows to overwrite existing rows if they have the same unique key value.-i or –ignoreIgnore rows that have the same unique key value as existing rows.-f or –forceForce mysqlimport to continue inserting data even if errors are encountered.-l or --lock-tablesLock each table before importing (a good option on a busy server).-d or –deleteEmpty the table before inserting.--fields-terminated- by='char'Specify the separator used between values of the same row, default \t (tab).--fields-enclosed- by='char'Specify the delimiter that encloses each field; ... Read More

How can we upload data into multiple MySQL tables by using mysqlimport?

varun
Updated on 20-Jun-2020 10:37:03

329 Views

With the help of mysqlimport we can upload data into multiple MySQL tables. It is illustrated in the example below −ExampleSuppose we want to upload the following data from two data files namely student1_tbl.txt −1     Saurav     11th 2     Sahil      11th 3     Digvijay   11thAnd House.txt1   Furniture 2   Television 3   RefrigeratorFollowings are MySQL tables into which we want to upload the above data −mysql> DESCRIBE Student1_tbl; +--------+-------------+------+-----+---------+-------+ | Field  | Type        | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | RollNo | int(11) ... Read More

Advertisements