Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up the statement of table query by SQL Server,Oracle,DB2

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "SQL Server,Oracle,DB2 how to build table query sentence", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "SQL Server,Oracle,DB2 how to establish table query statement" bar!

How to compare the statements of establishing table query in SQLServer,Oracle,DB2

Statements created on SQLServer using subqueries:

SELECTempno,ename,sal*12ANNSAL,hiredateintodept30FROMempWHEREdeptno=30

On Oracle, the query is used to build the table:

CREATETABLEdept30ASSELECTempno,ename,sal*12ANNSAL,hiredateFROMempWHEREdeptno=30

On DB2, the query is used to build the table:

Createtabledept30as (SELECTempno,ename,sal*12ANNSAL,hiredateFROMempWHEREdeptno=30) definitiononly;insertintodept30SELECTempno,ename,sal*12ANNSAL,hiredateFROMempWHEREdeptno=30

You can also use this statement in DB2 to copy the data in the table. Copytable:createtableemp_baklikeemp

How to compare the statements of SQLServer,Oracle,DB2 to modify tables

The statement on the SQLServer that adds columns:

ALTERTABLEdept30ADDjobVARCHAR (9)

The statement on the Oracle that adds columns:

ALTERTABLEdept30ADD (jobVARCHAR2 (9))

The statement on the DB2 that adds columns:

ALTERTABLEdept30ADDjobVARCHAR (9)

The statement on the SQLServer that modifies the column:

ALTERTABLEdept30ALTERcolumnenameVARCHAR (15)

The statement on the Oracle that modifies the column:

ALTERTABLEdept30MODIFY (enameVARCHAR2 (15))

The statement on the DB2 that modifies the column:

D:ALTERTABLEdept30ALTERcolumnenamesetdatatypeVARCHAR (15);

Thank you for your reading, the above is the content of "how to establish a table query statement in SQL Server,Oracle,DB2". After the study of this article, I believe you have a deeper understanding of how to establish a table query statement in SQL Server,Oracle,DB2, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report