Chandu yadav has Published 1163 Articles

How do I search for names starting with A in MySQL?

Chandu yadav

Chandu yadav

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

110 Views

Use LIKE for this, as shown below −select *from yourTableName where yourColumnName LIKE 'A%';Let us first create a table −mysql> create table DemoTable    (    StudentName varchar(100)    ); Query OK, 0 rows affected (0.66 sec)Now you can insert some records in the table using insert command −mysql> insert ... Read More

How to work multiple AND conditions in MySQL?

Chandu yadav

Chandu yadav

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

1K+ Views

To work with multiple AND conditions in MySQL, following is the syntax −select *from yourTableName where yourColumnName1=yourValue1 and yourColumnName2=yourValue2 and yourColumnName3=yourValue3;Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(20),    StudentAge int,    StudentCountryName varchar(40)   ... Read More

HTML download Attribute

Chandu yadav

Chandu yadav

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

132 Views

The download attribute of the element is used to set the name of the file to be downloaded which would download when user clicks on the hyperlink.Following is the syntax −The file is the name of the file set for download.Let us now see an example to implement the ... Read More

How can I position JButtons vertically one after another in Java Swing?

Chandu yadav

Chandu yadav

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

480 Views

Position buttons vertically one after another using the Box class. Use the createVerticalBox() method that displays components from top to bottom −JButton button1 = new JButton("One"); JButton button2 = new JButton("Two"); JButton button3 = new JButton("Three"); Box box = Box.createVerticalBox(); box.add(button1); box.add(button2); box.add(button3);The following is an example to position buttons ... Read More

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

Chandu yadav

Chandu yadav

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

588 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

Java Program to determine when a Frame or Window is closing in Java

Chandu yadav

Chandu yadav

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

1K+ Views

To determine when a Window is closing in Java, use the WindowListener, which is the listener interface for receiving window events..WindowListener listener = new WindowAdapter() {    public void windowClosing(WindowEvent evt) {       Frame frame = (Frame) evt.getSource();       System.out.println("Closing = "+frame.getTitle());    } };Above, we ... 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

106 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

93 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

566 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

187 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

Advertisements