Arjun Thakur

Arjun Thakur

749 Articles Published

Articles by Arjun Thakur

Page 75 of 75

MyISAM versus InnoDB in MySQL?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 347 Views

Both are engine types. Here is the query by which we can get to know which engine type and tables are being used. Firstly, we will choose the database with the help of USE command − mysql> USE business; Database changed Here is the query through which we can know which table or engine is being used − mysql> SHOW table status; The following is the output +------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+ |Name | Engine | Version | Row_format | ...

Read More

When should I use a composite index in MySQL?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 644 Views

The composite index can be used when we are using sub queries. The advantages of using composite index are in case of. Joining Filtering Selecting The following is the syntax of index. index(column_name1, column_name2, column_name3, column_name4, ............................N) Let us create a table first and within that we have set index. mysql> create table MultipleIndexDemo - > ( - > id int, - > FirstName varchar(100), - > LastName varchar(100), - > Address varchar(200), - > index(id, LastName, ...

Read More

What is the operator <=> in MySQL?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 278 Views

Here are the usages of the operator in MySQL. Case 1 This operator is similar to = operator i.e. when the value is equal then the result will become true(1), otherwise false(0). In the first case both = and operators work same. Case 2 Whenever we compare any value with NULL then the operator gives the value 0 and when we compare with NULL NULL, then it returns 1. While in case of = operator, this does not happen. Whenever we compare any value with NULL, it returns NULL. If we compare NULL with NULL, then ...

Read More

Shortcomings of mysql_real_escape_string?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 196 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.

Read More

How to escape apostrophe (') in MySQL?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 3K+ Views

We can escape apostrophe (‘) in MySQL in the following two ways − We can use backslash. We can use single quotes twice (double quoted) Using backslash Let us first create a table. mysql> create table SingleQuotesDemo - > ( - > id int, - > name varchar(100) - > ); Query OK, 0 rows affected (1.16 sec) Following direct usage does not give the desired result for name “John’s”. mysql> insert into SingleQuotesDemo values(1, 'John's'); '> Let us now use backslash. ...

Read More

How to get a list of MySQL user accounts?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 235 Views

To get the list of MySQL user accounts, we can use “SELECT USER”. The following is the query to display the list. SELECT User FROM mysql.user; Here is the output. +------------------+ | User | +------------------+ | John | | Mac | | Manish | | mysql.infoschema | | mysql.session ...

Read More

How to save MySQL query output to excel or .txt file?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 4K+ Views

To save MySQL query output into a text file, we can use the OUTFILE command. Let us first create a table. mysql> create table SaveintoTextFile -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.55 sec) Inserting records into the table. mysql> insert into SaveintoTextFile values(1, 'John'); Query OK, 1 row affected (0.44 sec) mysql> insert into SaveintoTextFile values(101, 'Carol'); Query OK, 1 row affected (0.17 sec) mysql> insert into SaveintoTextFile values(3, 'David'); Query OK, 1 row ...

Read More

How can I restore the MySQL root user full privileges?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 2K+ Views

We can restore the MySQL root user full privileges with the help of UPDATE command. Firstly, you need to stop mysqld and restart it with the --skip-grant-tables option. After that, connect to the mysqld server with only mysql (i.e. no -p option, and username may not be required). Issue the below given command in the mysql client to restore the MySQL root user with full privileges. mysql> UPDATE mysql.user SET Grant_priv = 'Y', Super_priv = 'Y' WHERE User = 'root'; Query OK, 0 rows affected (0.04 sec) Rows matched: 1 Changed: 0 Warnings: 0 Above, ...

Read More

Sum of all proper divisors of a natural number in java

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 585 Views

Following is the Java program which prints all the sum of all the divisors of a given number.

Read More
Showing 741–749 of 749 articles
« Prev 1 71 72 73 74 75 Next »
Advertisements