Ramu Prasad has Published 74 Articles

How can we fetch a second highest salary of an employee from a MySQL table?

Ramu Prasad

Ramu Prasad

Updated on 22-Jun-2020 12:39:06

168 Views

To understand this concept, we are using the data from table ‘Salary’ as follows −mysql> Select * from Salary; +--------+--------+ | Name   | Salary | +--------+--------+ | Gaurav |  50000 | | Rahul  |  40000 | | Ram    |  45000 | | Raman  |  45000 | +--------+--------+ 4 ... Read More

What is the use of ‘c’ option while writing MySQL statements?

Ramu Prasad

Ramu Prasad

Updated on 22-Jun-2020 11:40:20

278 Views

‘\c’ option means ‘clear’ and is used to clear the current input. Suppose if we do not want to execute a command that we are entering, then we can use a clear \c option which clears the current input. For example, the use of \c option can be done as ... Read More

How can we run a MySQL statement without termination semicolon?

Ramu Prasad

Ramu Prasad

Updated on 22-Jun-2020 10:55:03

255 Views

With the help of \G or \g option just at the end of the MySQL statement, we can run it without the semicolon. Consider the example below −mysql> Select * from Stock_item\G *************************** 1. row *************************** item_name: Calculator     Value: 15  Quantity: 89 *************************** 2. row *************************** item_name: Notebooks ... Read More

How MySQL IF statement can be used in a stored procedure?

Ramu Prasad

Ramu Prasad

Updated on 22-Jun-2020 05:51:19

362 Views

MySQL IF statement implements a basic conditional construct within a stored procedure. Its syntax is as follows −IF expression THEN Statements; END IF;It must end with a semicolon. To demonstrate the use of IF statement within MySQL stored procedure, we are creating the following stored procedure which is based on ... 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 13:47:45

73 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.

How can we convert TIME and DATETIME values to numeric form in MySQL?

Ramu Prasad

Ramu Prasad

Updated on 19-Jun-2020 13:43:29

437 Views

Conversion of TIME(N) and DATETIME(N) values to numeric form can be done by adding 0(+0) to them. Followings are the rules for such kind of conversion −Converted to INTEGERThe TIME(N) and DATETIME(N) values will be converted to an integer when N is 0.For example, the values of CURTIME() and NOW() ... Read More

How to get base 10 logarithms of E in JavaScript?

Ramu Prasad

Ramu Prasad

Updated on 19-Jun-2020 07:22:18

67 Views

To get base 10 logarithms of E, use the Math LOG10E property. It returns base 10 logarithm of E which is approximately 0.434.ExampleYou can try to run the following code to get base 10 logarithms of E in JavaScript −           JavaScript Math LOG10E Property   ... Read More

How to compare two JavaScript Date Objects?

Ramu Prasad

Ramu Prasad

Updated on 18-Jun-2020 09:16:50

236 Views

To compare two date objects with JavaScript, create two dates object and get the recent date to compare it with the custom date.ExampleYou can try to run the following code to compare two dates −Live Demo                    var date1, date2; ... Read More

How to bitwise XOR of hex numbers in Python?

Ramu Prasad

Ramu Prasad

Updated on 17-Jun-2020 14:47:12

2K+ Views

You can get the XOR of any type of numbers using the ^ operator. Specifically for hex numbers, you can use:a = 0x12ef b = 0xabcd print(hex(a ^ b))This will give the output:0xb922The 0x at the beginning of the numbers implies that the number is in hex representation. You can ... Read More

How will you explain Python for-loop to list comprehension?

Ramu Prasad

Ramu Prasad

Updated on 17-Jun-2020 12:32:24

79 Views

List comprehensions offer a concise way to create lists based on existing lists. When using list comprehensions, lists can be built by leveraging any iterable, including strings and tuples. list comprehensions consist of an iterable containing an expression followed by a for the clause. This can be followed by additional ... Read More

Advertisements