Database Articles

Page 163 of 546

How can we get “MySQL server-side help”?

radhakrishna
radhakrishna
Updated on 20-Jun-2020 226 Views

MySQL provides help command to get server-side help. The syntax of this command is as follows −mysql> help search_stringMySQL uses the argument of help command as the search string for accessing the contents of MySQL reference manual. The search will fail if there would be no match for the search string.For example − suppose I want to get server-side help regarding INTEGER data type then the command for the same would be as follows −mysql> help INTEGER Name: 'INTEGER' Description: INTEGER[(M)] [UNSIGNED] [ZEROFILL] This type is a synonym for INT. URL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html

Read More

How can we calculate the Date in MySQL using functions?

Ayyan
Ayyan
Updated on 20-Jun-2020 219 Views

In MySQL, we can use the following functions to calculate the Date −CURDATE() Function − Basically it returns the current date of the computer.YEAR() Function − It returns the year of the specified date.MONTH() function − It returns the month of the specified date.DAY() Function − It returns the day of the specified date.RIGHT() Function − It returns the number of character as specified within the function from the given date. The part of the expression that compares the returns from RIGHT() function evaluates 1 or 0.To understand it, consider the data, as follows, from a table named ‘Collegedetail’ −mysql> ...

Read More

How can we use ORDER BY clause while calculating the Date?

Kumar Varma
Kumar Varma
Updated on 20-Jun-2020 181 Views

It would be more convenient to find a record if we will use ORDER BY clause while calculating the date. To understand it, we have the data from table ‘Collegedetail’ as follows −mysql> Select * from Collegedetail; +------+---------+------------+ | ID   | Country | Estb       | +------+---------+------------+ | 111  | INDIA   | 2010-05-01 | | 130  | INDIA   | 1995-10-25 | | 139  | USA     | 1994-09-25 | | 1539 | UK      | 2001-07-23 | | 1545 | Russia  | 2010-07-30 | +------+---------+------------+ 5 rows in set (0.00 sec)Now, suppose if ...

Read More

Do we require any authentication for login into MySQL command line tool?

Prabhas
Prabhas
Updated on 20-Jun-2020 181 Views

Yes, we require authentication for login into MySQL command line tool. For example, if we are trying to log in from windows command line then it will prompt for the password every time. The command for login is as follows −C:\Program Files\MySQL\bin>mysql -u root -p Enter password: *****

Read More

How can we find out the storage engine used for a particular table in MySQL?

Govinda Sai
Govinda Sai
Updated on 20-Jun-2020 147 Views

The following MySQL statement can find out the storage engine used for ‘Student’ table in database named ‘tutorial’ −mysql> SELECT ENGINE FROM information_schema.TABLES   -> WHERE TABLE_SCHEMA = 'tutorial'   -> AND TABLE_NAME = 'Student'; +--------+ | ENGINE | +--------+ | MyISAM | +--------+ 1 row in set (0.13 sec)

Read More

While creating a MySQL table, how can I specify the storage engine of my choice rather than using the default storage engine InnoDB?

Ramu Prasad
Ramu Prasad
Updated on 20-Jun-2020 155 Views

While creating a MySQL table, the storage engine can be specified as follows −mysql> CREATE TABLE Student(id INTEGER PRIMARY KEY, Name VARCHAR(15)) -> ENGINE = 'MyISAM'; Query OK, 0 rows affected (0.28 sec)The ENGINE keyword specifies the storage engine used for this particular table.

Read More

How MySQL evaluates if I try to add two numbers that are contained in quotes?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 20-Jun-2020 141 Views

If we are trying to add two numbers that are contained in quotes, means we are treating the string as a number. In this case, MySQL converts the value into the closet numeric equivalent and evaluates the result. Following example will demonstrate it.Examplemysql> Select '1525' + '200'As Total; +-------+ | Total | +-------+ | 1725  | +-------+ 1 row in set (0.00 sec)

Read More

How can column data be used within MySQL CASE statement?

Rishi Raj
Rishi Raj
Updated on 20-Jun-2020 218 Views

To understand it consider the data, as follows, from the table ‘Students’ −mysql> Select * from Students; +----+-----------+-----------+----------+----------------+ | id | Name      | Country   | Language | Course         | +----+-----------+-----------+----------+----------------+ | 1  | Francis   | UK        | English  | Literature     | | 2  | Rick      | USA       | English  | History        | | 3  | Correy    | USA       | English  | Computers      | | 4  | Shane     | France    | ...

Read More

How can we establish MySQL database by using MySQL binary at command\\nprompt?

Sravani S
Sravani S
Updated on 20-Jun-2020 152 Views

You can establish the MySQL database using the mysql binary at the command prompt. It can be understood with the help of the following example −ExampleWe can use following statements to connect to the MySQL server from the command prompt −[root@host]# mysql -u root -p Enter password:******This will give us the mysql> command prompt where we will be able to execute any SQL command. Following is the result of above command −The following code block shows the result of above code −Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.20 MySQL ...

Read More

How can we distinguish between MySQL IFNULL() and NULLIF() functions?

karthikeya Boyini
karthikeya Boyini
Updated on 20-Jun-2020 3K+ Views

Actually, both MySQL IFNULL() and NULLIF() functions are having an almost same syntax as given below −The syntax of IFNULL()IFNULL(expression1, expression2)The syntax of NULLIF()NULLIF(expression1, expression2)They can be distinguished in the way they return the first argument as result. IFNULL() function will return the first argument as a result if it is not NULL and NULLIF() function will return the first argument as a result if both the arguments are not same.mysql> Select IFNULL('Ram', 'Shyam'); +-----------------------+ | IFNULL('Ram', 'Shyam') | +-----------------------+ | Ram                   | +-----------------------+ 1 row in set (0.00 sec) mysql> Select ...

Read More
Showing 1621–1630 of 5,456 articles
« Prev 1 161 162 163 164 165 546 Next »
Advertisements