A database is like a container. You have some tables in the container. Each table related to others with some special ways, so the owner of the database can easily maintain or manipulate the tables.
To create new database we have to run InterBase Windows Interactive SQL from the start menu.
Choose Create database, then the Create Database Window appears.
Enter your database name, for example : c:\mydata\mydatabase.gdb
Enter your username and password then press OK.
Now you’ve got a database named ‘mydatabase.gdb’ in folder ‘mydata’ , but you haven’t got any tables in it.
Creating a table
A table always has some rows and columns. Where each row represent each record of your table and each column represent each field of your record.
For example
a record of the table above has four fields : ID, Name, Age and PhoneNumber
To create a table in interbase, you have to write some Structured Query Language (SQL) codes in the InterBase Interactive SQL window. The SQL codes to create the table above is shown below :
create table employee(
id integer not null,
name varchar(30) not null,
age integer not null,
phonenumber varchar(12) not null)
then execute your codes.
Now, see each field we have in the table ‘employee’ :
fields data type
id integer
name string (has maximum character = 30)
age integer
phonenumber string (has maximum character = 12)
‘not null’ means that each field must have a value
Now you already have a database contains a table named ‘employee’. You can create another table with the same way. The number of table depends on your need.
Creating a Database Using Text Editor
Another way to create a database, you can type your SQL codes in a text editor (ie : notepad) before you execute them in InterBase Interactive SQL window.
Type these SQL codes in the text editor, then save it with a name : ‘mydata.txt’.
create database 'c:\mydata\mydata.gdb'
user 'NEW_USER' password 'password';
create table employee(
id integer not null,
name varchar(30) not null,
age integer not null,
phonenumber varchar(12) not null);
Go to the InterBase Interactive SQL window and execute the codes by choosing File – Run an ISQL script. And choose your ISQL script file : ‘mydata.txt’. If your SQL script has no errors, the database ‘mydata.gdb’ will be created and it contains a table ‘employee’.
keeerrreeeennn....
ReplyDeletehttp://mybestroom.blogspot.com
Repeatedly got the error
ReplyDeleteSQLCODE = -904
unavailable database
Cannot see why!
Bryan
We zijn niet alleen een Chinese uitvoerende fabriek , maar verwacht ook:
ReplyDeletemeer service.
makkelijkere en heldere communicatie in uw eigen Nederlandse taal
een berg aan know-how en ervaring op het gebied van materialen en kunststof product engineering.