The = , <>, <=, <, >=, >,<<,>>, <=>, AND, OR or LIKE operators are used in column comparisons in SELECT statements.
How can we get the number of rows affected by query?
Number of affected rows can be obtained as per following.
/* this should return the correct numbers of deleted records */
mysql_query(‘DELETE FROM mytable WHERE id < 10’);
printf(“Records deleted: %d\n”, mysql_affected_rows());
Is Mysql query is case sensitive?
No.
Example:
SELECT
*
FROM
table;
select
*
from
table;
What is the difference between the LIKE and REGEXP operators?
LIKE and REGEXP operators are used to express with ^ and %.
Example:
SELECT * FROM table WHERE column REGEXP “^x”;
SELECT * FROM table WHERE column LIKE “%x”;
What is the difference between BLOB and TEXT?
A BLOB is a binary large object that can hold a variable amount of data. There are four types of BLOB –
- TINYBLOB
- BLOB
- MEDIUMBLOB and
- LONGBLOB
They all differ only in the maximum length of the values they can hold.
A TEXT is a case-insensitive BLOB. The four TEXT types
- TINYTEXT
- TEXT
- MEDIUMTEXT and
- LONGTEXT
They all correspond to the four BLOB types and have the same maximum lengths and storage requirements.
The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive for BLOB values and case-insensitive for TEXT values.
What is the difference between mysql_fetch_array and mysql_fetch_object?
Following are the differences between mysql_fetch_array and mysql_fetch_object:
mysql_fetch_array -Returns a result row as an associated array or a regular array from database.
mysql_fetch_object – Returns a result row as object from database.
How can we run batch mode in mysql?
Following commands are used to run in batch mode:
mysql ;
mysql mysql.out
run batch mode in mysql