Chandu yadav has Published 1090 Articles

Display dates after NOW() + 10 days from a MySQL table?

Chandu yadav

Chandu yadav

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

776 Views

You can use DATE_ADD() function with where clause for this. Let us first create a table −mysql> create table DemoTable    (    ShippingDate date    ); Query OK, 0 rows affected (0.54 sec)Note : The current date and time is as follows, we found using NOW() −mysql> select now(); ... Read More

How to create an invisible fixed height component between two components in Java?

Chandu yadav

Chandu yadav

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

197 Views

Use the createVerticalStrut() method to create an invisible fixed height component between two components. Let’s say we have some button and we are creating a fixed height between them −box.add(button4); box.add(Box.createVerticalStrut(50)); box.add(button5); box.add(Box.createVerticalStrut(30)); box.add(button6);The following is an example to create an invisible fixed height component between two components in Java ... Read More

MySQL query to alphabetize records and count the duplicates?

Chandu yadav

Chandu yadav

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

161 Views

For this, use both GROUP BY and ORDER BY clause. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentGrade char(1)    ); Query OK, 0 rows affected (0.87 sec)Insert some records in the table using insert command ... Read More

HTML charset Attribute

Chandu yadav

Chandu yadav

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

725 Views

The charset attribute of the element is used to specify the character encoding for the HTML document. You can use the charset attribute on as well as element.Different charsets include ASCII, ANSI, ISO-8859-1, UTF-8, etc. ISO-8859-1 supports 256 different character codes. ASCII defined 128 different alphanumeric characters. ... Read More

Can we read from JOptionPane by requesting input from user in Java?

Chandu yadav

Chandu yadav

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

269 Views

Yes, we can read from JOptionPane. Here, we will get the result of the showInputDialog() in a String variable −String input = JOptionPane.showInputDialog("Enter the C++ lessons you covered till now?");After getting the result, we will convert it to integer with parseInt() and display it on Console −int res = Integer.parseInt(input); ... Read More

Sorted difference between two columns in MySQL?

Chandu yadav

Chandu yadav

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

529 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

137 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

4K+ 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

Add two weeks to a date in MySQL?

Chandu yadav

Chandu yadav

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

797 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

Advertisements