SQL SELECT Database

In case multiple databases exist in the SQL schema we have to select the database before performing any operation. The USE statement is used to select any existing database in SQL schema. Syntax: USE databaseName; Example: USE w3schools_db;   Next Topic: SQL DROP Database with example. Previous Topic: SQL SHOW Database List with example.  

Categories SQL

SQL SHOW Database List

To show the list all existing databases in SQL schema we have to use SHOW DATABASES statement. Syntax: SHOW DATABASES;   Next Topic: SQL SELECT Database with example. Previous Topic: SQL CREATE Database with example.  

Categories SQL

SQL CREATE Database

The SQL CREATE DATABASE statement is used to create a new database. Syntax: CREATE DATABASE databaseName; Note: Database name should be unique within the RDBMS. Example: CREATE DATABASE w3schools_db;   Next Topic: SQL SHOW Database List with example. Previous Topic: SQL operators.  

Categories SQL

SQL operators

Operator: An operator is a special symbol which used to perform a specific operation. SQL operators: SQL operators are the reserved words or special symbols or characters that are used to perform specific operations. Types of SQL operators: SQL Arithmetic Operators SQL Comparison Operators SQL Logical Operators 1. SQL Arithmetic Operators: Let us consider the … Read more

Categories SQL

SQL data type

SQL data type defines the type and range of the data that can be used with SQL Server. Commonly used SQL data types: Data Type Syntax Description integer integer  Integer number. smallint smallint  Small integer number. numeric numeric(p,s) Where p is a precision value; s is a scale value. For example, numeric(7,3) is a number … Read more

Categories SQL

JDBC driver

Driver: A driver is a software component that provides the facility to a computer to communicate with hardware. JDBC driver: A driver is a software component that provides the facility to interact java application with the database. Types of JDBC drivers: JDBC-ODBC bridge driver. Native-API driver. Network-Protocol driver. Thin driver. 1. JDBC-ODBC bridge driver: JDBC-ODBC … Read more

JDBC batch processing

The JDBC batch processing provides the facility to execute a group of related queries. A group of related queries is known as a batch. It reduces the amount of communication overhead and hence improves the performance. JDBC batch processing methods: 1. addBatch(String query): It is used to add the statement to the batch. Syntax: public … Read more

JDBC DatabaseMetaData interface

The metadata refers to the data about data. The DatabaseMetaData interface provides the facility to get the information like driver name, total number of tables and driver version etc. We can get the object of DatabaseMetaData by calling getMetaData() method of Connection interface. Syntax: DatabaseMetaData dbmd=conn.getMetaData(); Commonly used methods of DatabaseMetaData: 1. getDriverName(): It is used … Read more

JDBC ResultSetMetaData interface

The metadata refers to the data about data. The ResultSetMetaData interface provides the facility to get the information like table name, total number of column, column name and column type etc. We can get the object of ResultSetMetaData by calling getMetaData() method of ResultSet interface. Syntax: ResultSetMetaData rsmd = resultSet.getMetaData(); Commonly used methods of ResultSetMetaData: 1. … Read more

JDBC transaction management

Transaction: A transaction is a sequence of operation which works as an atomic unit. A transaction only completes if all the operations completed successfully. A transaction has the Atomicity, Consistency, Isolation and Durability properties (ACID). JDBC transaction management: By default JDBC connection is in auto-commit mode and we can’t control it i.e. whenever a SQL … Read more