Chandu yadav has Published 1163 Articles

Sorted difference between two columns in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

376 Views

Use ORDER BY clause for this. Let us first create a table −mysql> create table DemoTable    (    Value1 int,    Value2 int    ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, 40); Query OK, 1 ... Read More

HTML for Attribute

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

104 Views

The for attribute of the element sets the relationship between the result of the calculation and the elements used in the calculation.Following is the syntax:Above, id is the element id, which sets a separate list of one or more elements with a space. These elements specify the relationship between ... Read More

How to make JOptionPane to handle Yes, No and Closed buttons in Java?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

2K+ Views

For this, create JOptionPane.QUESTION_MESSAGE and with the user action display individual messages, for example −int res = JOptionPane.showOptionDialog(new JFrame(), "Do you like Cricket?", "Hobbies", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { "Yes", "No" }, JOptionPane.YES_OPTION); if (res == JOptionPane.YES_OPTION) {    System.out.println("Selected Yes!"); }Above, we have displayed a message on console ... Read More

Combining multiple rows into a comma delimited list in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

3K+ Views

To combine multiple rows into a comma delimited list, use the GROUP_CONCAT() method. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Name varchar(30),    Marks int    ); Query OK, 0 rows affected (0.52 sec)Insert some records ... Read More

Complex Numbers in Python?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

17K+ Views

A complex number is created from real numbers. Python complex number can be created either using direct assignment statement or by using complex () function.Complex numbers which are mostly used where we are using two real numbers. For instance, an electric circuit which is defined by voltage(V) and current(C) are ... Read More

Add two weeks to a date in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

623 Views

To add two weeks to a date in MySQL, use DATE_ADD() −insert into yourTableName(yourColumnName) values(date_add(now(), interval 2 week));Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime    ); Query OK, 0 rows affected (0.62 sec)Following is ... Read More

How to create a Confirmation Dialog Box in Java?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

3K+ Views

To create a confirmation dialog box in Java, use the Java Swing JOptionPane.showConfirmDialog() method, which allows you to create a dialog box that asks for confirmation from the user. For example, Do you want to restart the system?, “This file contains a virus, Do you want to still download?”, etc. ... Read More

MySQL query to fetch date with year and month?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

277 Views

For year and month date fetching, you can use YEAR() and MONTH() function in MySQL. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime    ); Query OK, 0 rows affected (0.48 sec)Insert some records in ... Read More

How to remove menus from MenuBar in Java?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

313 Views

Remove a menu from the MenuBar using the remove() method. Set the index for the menu you want to remove from the MenuBar.Let’s say we have the following two menus initially −The following is an example to remove one the above menus. Let’s say we are removing the 2nd menus ... Read More

str() vs repr() in Python?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:26

2K+ Views

Both str() and repr() methods in python are used for string representation of a string. Though they both seem to serve the same puppose, there is a little difference between them.Have you ever noticed what happens when you call a python built-in function str(x) where x is any object you ... Read More

Advertisements