Re: Some basic SQL Questions

From: "William ZHANG" <uniware_at_zedware_dot_org(at)antispam(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Some basic SQL Questions
Date: 2004-01-13 11:59:47
Message-ID: bu0mkk$2kji$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Steven O." <Steven(at)OpZZREMOVE_ALL_Zs_AND_ALL_BETWEEN_ZZComm(dot)com> wrote:
hh73001fej4r1hotrvk030ubmpffdc6r0a(at)4ax(dot)com(dot)(dot)(dot)
> First, this may not be the correct newsgroup. I have some relatively
> basic questions on SQL. I tried to find a newsgroup that was
> specifically just about SQL, and was surprised to find that all the
> SQL-related newsgroups seem to be product related. But if I missed
> something, and someone can steer me to a correct newsgroup, please do
> so.
comp.databases.theory covers database theory. You can find some stuff
on SQL standards. For the basic SQL, some textbooks on SQL is helpful.

>
> My specific questions:
>
> 1. I want to put comments in an SQL script. For example, I want
> something like
>
> CREATE TABLE myTable
> (field1 CHAR(10), /* References the field1 table */
> field2 DECIMAL(3,2) /* References field2 table */
> );

The standard way is using "--". Like,
-- create a emp table
create table emp(
fno int, -- number of emp
fname char(8) -- name of emp.
)

Some DBMSs, e.g. PostgreSQL, also support /* ... */.

>
> Here, I've used C-style comments, but I don't think that works with
> SQL. Is there any other syntax for sticking comments in a script?
>
> 2. I am writing my script based on some texts from an Oracle class I
> took a year ago. But an online .pdf tutorial I found lists some data
> types that are not in my text:
> varchar2(n)
> number(o,d)
> Are these valid!?

See ORACLE's manuals for details. They are valid data types
in ORACLE.

>
> 3. Is there any kind of "memo" field in SQL? My database references
> some text that may be arbitrary in length (like ingredients for a
> recipe), and a way to link to memo fields would be helpful. Or, is
> that the purpose of the varchar2 data type?

Use BYTEA/TEXT in PostgreSQL.
Use BLOB/CLOB in standard SQL, ORACLE, ....
Use IMAGE/TEXT in MSSQL.

>
> Thanks in advance for all replies.

You are welcome.

>
> Steve O.
>
>
> Standard Antiflame Disclaimer: Please don't flame me. I may actually
*be* an idiot, but even idiots have feelings.

Browse pgsql-general by date

  From Date Subject
Next Message Anton.Nikiforov 2004-01-13 12:01:34 Re: Parse error help needed...
Previous Message Richard Huxton 2004-01-13 11:48:18 Re: Reallife szenario for GEQO