473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Some basic SQL Questions

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.

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 */
);

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!?

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?

Thanks in advance for all replies.

Steve O.
Standard Antiflame Disclaimer: Please don't flame me. I may actually *be* an idiot, but even idiots have feelings.
Jul 19 '05 #1
2 5160
At some point in time, Steven O.
<Steven@OpZZREMOVE_ALL_Zs_AND_ALL_BETWEEN_ZZComm.c om> wrote:
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.
Well, the answers you are most likely to get *here* will be specifically related
to PostgreSQL. However, its SQL dialect is pretty close to what most other
vendors support, so you should be OK in 97% of the things you try.

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 */
);

Perfectly acceptable in Pg. It also accepts the "--" line comment sequence (in
which everything after a bare, unquoted "--", until the end of the line, is a
comment).
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!?
Depends on the specific SQL you are using. In Pg, it's fine.

http://www.postgresql.org/docs/curre.../datatype.html


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?


"TEXT" is the unspecified length datatype in Pg. See the previous URL.
--
~~~~~~~~~~~~~~~~| Genius may have its limitations, but stupidity is not
Jeff Boes | thus handicapped.
jb***@qtm.net | --Elbert Hubbard (1856-1915), American author
Jul 19 '05 #2

"Steven O." <Steven@OpZZREMOVE_ALL_Zs_AND_ALL_BETWEEN_ZZComm.c om> wrote:
hh********************************@4ax.com...
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.
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steven O. | last post by:
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...
7
by: Steven O. | last post by:
I am basically a hobbyist programmer, at the moment doing a little work experimenting with some AI stuff. I learned C++, and then tried to teach myself MFC using MS Visual C++ 6.0. I swore off of...
12
by: Vibhajha | last post by:
Hi friends, My sister is in great problem , she has this exam of C++ and she is stuck up with some questions, if friends like this group provides some help to her, she will be very grateful....
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
1
by: danilo of TUP | last post by:
Greetings, im Danilo, a student from TUP Manila and taking up COMPUTER SCIENCE. we are going to have a defense or we could say a project in turbo c. i just wanna know how to use the SWITCH...
3
by: aziz001DETESTSPAM | last post by:
I've been following some tutorials and reading books and have a basic grasp of the fundamental ADO.NET commands. But all the books I've read use a database with only 1 table. My database has many,...
2
by: Water Cooler v2 | last post by:
I've not touched SQL server programming since 1999. I have very little memory of it and need some clarifications on some basic questions that I could even use a book for. Until I get myself a good...
0
by: software2006 | last post by:
ASP And Visual Basic Interview questions and answers I have listed over 100 ASP and Visual Basic interview questions and answers in my website...
3
by: alcapoontje | last post by:
hi there, i'm already searching the internet for a couple of days to find an answer on this (simple) questions but i couln't find anything usefull. - how to quit and open a programm like "word" with...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.