Java ResultSet findColumn Method with Example

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

1K+ Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The findColumn() method of the ResultSet interface maps the column label to column index. Using this you can find the index of a particular column in the result set.This method accepts a String ... Read More

Search by Specific Pattern in MySQL

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

174 Views

You can use regular expression for this. Let us first create a table −mysql> create table DemoTable    (    UserId varchar(100)    ); Query OK, 0 rows affected (1.28 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('User-123-G'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Us-453-GO'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('TRUE-908-K'); Query OK, 1 row affected (0.20 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+------------+ | UserId     | ... Read More

Display JTextArea in a Table using GridLayout in Java

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

799 Views

Display a component in the form of rows and columns using the GridLayout. Here, we have set a panel, within which we will create a layout with 3 rows and 5 columns −JPanel panel = new JPanel(new GridLayout(3, 5, 5, 5));Now, loop through and display JTextArea from 1 to 15 i.e. 3 rows and 5 columns −for (int i = 1; i

Include, Require, Include_once and Require_once Functions in PHP

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

4K+ Views

In this article, we will learn about useful and important functions in PHP for file inclusion. All these functions require, require_once, include and include_once are utilized to include the files in the php page but there is a slight distinction among them in terms of functionality.Let's discuss these functions below with their functionality.include() :This function is used to include a file in a PHP page. If include() function is not able to find a specified file on location at that time it will throw a warning message however, it will not stop script execution.require():This function is utilized to add a ... Read More

What is System.exit in Java

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

355 Views

This method belongs to the System class of the java.lang package. It terminates the current JVM (Java Virtual Machine).This method accepts an integer value representing the status code, it accepts two values 0 or, 1 or, -1. Where, 0 indicates a successful termination and 1 or, -1 indicates an unsuccessful termination.ExampleFollowing program accepts an array of elements from the user and prints the it. While printing if any of the given elements is greater or equal to 20 the program exits. Live Demoimport java.util.Scanner; public class System_Exit_Example {    public static void main(String args[]){       Scanner sc = new ... Read More

Convert String to Date as Column in SQL

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

106 Views

You can use having clause. Let us first create a table −mysql> create table DemoTable    -> (    -> AdmissionDate varchar(100)    -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('10/12/2017'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('01/11/2018'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('31/01/2019'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('09/06/2019'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('19/04/2019'); Query OK, 1 ... Read More

HTML DOM Input datetime-local Required Property

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

139 Views

The HTML DOM Input DatetimeLocal required property determines whether Input DatetimeLocal is compulsory to set or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDatetimeLocalObject.requiredSetting required to booleanValueinputDatetimeLocalObject.required = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt is compulsory to set the datetimeLocal field to submit form.falseIt is the default value and to set datetimeLocal field is not compulsory.ExampleLet us see an example of Input DatetimeLocal required property − Input DatetimeLocal required    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {     ... Read More

HTML DOM KeyboardEvent location Property

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

139 Views

The HTML DOM KeyboardEvent loaction property returns the number corresponding to location of key pressed on the keyboard.SyntaxFollowing is the syntax −Returning location of pressed key −event.locationNumbersHere, number returned can be the following −numberDescriptions0It represents almost all values on the keyboard. (every key in the middle section of keyboard, eg: ‘Q’, ’\’, ’spacebar’)1It represents the values on the left-keyboard. (every key in the left section of keyboard, eg: ‘left ctrl’, ’left Shift’, ’left alt’)2It represents the values on the right-keyboard. (every key in the right section of keyboard, eg: ‘right ctrl’, ’right Shift’, ’right alt’)3It represents the values on the ... Read More

Java ResultSet deleteRow Method with Example

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

3K+ Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The deleteRow() method of the ResultSet interface deletes the current row from the ResultSet object and from the table.rs.deleteRow();Let us create a table with name MyPlayers in MySQL database using CREATE statement as ... Read More

Make MySQL Table Primary Key Auto Increment

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

1K+ Views

To make MySQL table primary key auto increment, use the below syntaxCREATE TABLE yourTableName    (    yourColumnName INT(6) ZEROFILL NOT NULL AUTO_INCREMENT,    PRIMARY KEY(yourColumnName)    );Let us first create a table and set primary key auto increment −mysql> CREATE TABLE DemoTable    (    UserId INT(6) ZEROFILL NOT NULL AUTO_INCREMENT,    PRIMARY KEY(UserId)    ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command −mysql> INSERT INTO DemoTable values(); Query OK, 1 row affected (0.12 sec) mysql> INSERT INTO DemoTable values(); Query OK, 1 row affected (0.13 sec) mysql> INSERT ... Read More

Advertisements