Sybase Tables

Sybase Tables: Tables are used to the data in the respective columns.

Rules to create tables:

  • Table name should contains alphabets numbers, and underscore(_). But table name can not start with numbers.
  • Column names must be unique within a table.
  • We can create temporary table by appending # to table name in the create table syntax.
  • To create table, user should be granted the create permission.
  • A database can contain 200K tables.
  • We can get table information by running procedure sp_help table_name.

Syntax:

CREATE TABLE table_name
(column_name1 datatype, column_name2 datatype, ….
)

Examples:

use bank
go
create table student(student_id int, student_name varchar(30), student_dob datetime, student_section varchar(5))
go

create table bank..account(account_id int, account_name varchar(50), account_type char)
go

Insert data into a table:

use bank
go
insert into account values(1001, ‘George’,’S’)
insert into account values(1002, ‘Mike’, ‘C’)
insert into account values(1003, ‘Baliredd’, ‘C’)
insert into account values(1004, ‘Clamore’, ‘S’)
go

Powered by k2schools