SQL database programming technology in JSP

Source: Internet
Author: User

SQL database programming technology in JSP
I. SQL review
1. SQL statements are divided into two types: DDL (Data Definition Language) and DML (Dat Manipulation Languge, Data operation Language ). The former mainly defines the logical structure of data, including the definition of tables, views and indexes. DML mainly queries and updates databases.
2. Create Table (DDL ):
Create Table tabName (
ColName1 colType1 [else],
ColName2 colType2 [else],
...,
ColNamen colTypen [else]
);
Example: Cteate Table pJoiner (
Pno char (6) not null,
Eno char (6) nut null
);
Char int varchar and so on are reserved words used to define the column data type. varchar indicates a variable character type.
3, Select <col1>, <col2>,..., <coln>
From <tab1>, <tab2>,..., <tabm>
[Where <condition>]

Subquery in the condition:
Where Not Exists (
Select * From tab2 Where col1 = col2
) // When the query result is null, the condition is true.

4. insert into <tab1> VALUES (<col1>,... <coln>)
5. delete from <tab1> [WHERE <condition>]
6. UPDATE <tab1>
SET <tab1 >=< vlu1>
...
<Tabn >=< vlun>
[WHERE <condition>]
For example:
Update exployee
Set age = 27
Where name = 'Zhao Yi'
2. Main JDBC interfaces:
The java. SQL. DriverManager class is used to process driver calls and support new database connections.
Java. SQL. Connection refers to the Connection between an application and a specific database.
Java. SQL. Statement, used for the execution of general SQL statements (it can be the execution process of queries, updates, or even database creation)
Java. SQL. ResultSet, the results returned by the query are saved in this object, which allows you to browse and access records in the database.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.