Firebird Common statements

Source: Internet
Author: User

A small example of pagination
1 of ten;  --FIREBIRD2.0 supports this notation
Show table name and table structure
SHOW TABLES;  SHOW TABLE TableName;
Connect to a database using isql
Firebird%92bin>isql-u sysdba-p masterkey  SQL'e:companyxmwsoftnewxmwsoftc2dbcts2.fdb  ';  or  SQL'e:%92'  CON'sysdba'    CONT'masterkey';
Update Field comments
' Description Information '  ' shop'' credit_buy ')
Show Field Comments
'  Shop '  'credit_buy')
Update table comments
' Description Information '  'table_name';

Querying all tables and views (including system tables and system views)
SELECT Rdb$relation_namefrom rdb$relations;

Querying all user tables and user views
0;
Querying all of the user tables
  SELECT rdb$relation_name from  rdb$relations  0and  Rdb$view_blr are NULL;

All user tables, user views all fields and related definitions
  SELECT    a.rdb$relation_name,    b.rdb$field_name,    b.rdb$field_id,    d.rdb$type_name,    c. Rdb$field_length,    C.rdb$field_scale from  rdb$relations a    INNER JOIN rdb$relation_fields b      = B.rdb$relation_name    INNER join Rdb$fields c      = c.rdb$field_name    INNER join rdb$types d      = D.rdb$type   0 ' Rdb$field_type' ORDER by A.rdb$relation_name, b.rdb$        field_id;
Find all fields and related definitions for a table
  SELECT    a.rdb$field_name,    b.rdb$field_type,    b.rdb$field_length,    b.rdb$field_precision,    B.rdb$field_scale  From Rdb$relation_fields A, rdb$fields B  'tablename'    = B.rdb$field_name  ORDER by A.rdb$field_position;

Find the primary key definition field for a table
  SELECT a.rdb$field_name from  rdb$index_segments A, rdb$relation_constraints B  '  PRIMARY KEY'    tablename'=     b.rdb$ Index_name  ORDER by a.rdb$field_position;
Find foreign key definitions for a table
SELECT R1. Rdb$constraint_name, Rind. Rdb$field_name, R2. Rdb$relation_name from rdb$relation_constraints R1, rdb$relation_constraints R2, rdb$ref_constraintsref, rdb$index_segments rind WHERE R1. Rdb$relation_name='TableName'and R1. Rdb$constraint_type='FOREIGN KEY'and R1. Rdb$constraint_name=ref. Rdb$constraint_name andref. Rdb$const_name_uq =R2. Rdb$constraint_name and R1. Rdb$index_name= Rind. Rdb$index_name;

Firebird Common statements

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.