File: alter_table.l.html

package info (click to toggle)
mpsql 2.0-2
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 2,912 kB
  • ctags: 5,665
  • sloc: ansic: 34,322; makefile: 3,525; sh: 17
file content (72 lines) | stat: -rw-r--r-- 2,673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!-- manual page source format generated by PolyglotMan v3.0.4, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->

<HTML>
<HEAD>
<TITLE>"ALTER(TABLE") manual page</TITLE>
</HEAD>
<BODY>
<A HREF="sql.html">SQL Reference Contents</A>
 
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
alter table - add attributes to a class  
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2>
<B>alter table </B> classname 
[ * ] <BR>
 <tt> </tt><tt> </tt><B>add </B> [ <B>column </B> ] attname type <BR>
 <B>alter table </B> classname [ * ] <BR>
 <tt> </tt><tt> </tt><B>add 
</B> <B>( </B> attname type <B>) </B> <BR>
 <tt> </tt><tt> </tt> <BR>
  
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
The <B>alter table</B> command causes a new 
attribute to be added to an existing class, <I>classname</I>. The new attributes 
and their types are specified in the same style and with the the same 
restrictions as in <I>create <A HREF="table.l.html">table</I>(l)</A>
. <P>
In order to add an attribute to each 
class in an entire inheritance hierarchy, use the <I>classname</I> of the superclass 
and append a `*'.  (By default, the attribute will not be added to any of 
the subclasses.)  This should <B>always</B> be done when adding an attribute to 
a superclass.  If it is not, queries on the inheritance hierarchy such 
as select * from super* s <BR>
 will not work because the subclasses will be 
missing an attribute found in the superclass. <P>
For efficiency reasons, default 
values for added attributes are not placed in existing instances of a 
class.  That is, existing instances will have NULL values in the new attributes. 
 If non-NULL values are desired, a subsequent <I><A HREF="update.l.html">update</I>(l)</A>
 query should be 
run. <P>
You must own the class in order to change its schema.  
<H2><A NAME="sect3" HREF="#toc3">EXAMPLE </A></H2>
-- <BR>
 -- add 
the date of hire to the emp class <BR>
 --  <BR>
 alter table emp add column hiredate 
abstime <BR>
 -- <BR>
 -- add a health-care number to all persons <BR>
 -- (including employees, 
students, ...) <BR>
 -- <BR>
 alter table person * add column health_care_id int4 <BR>
  
<H2><A NAME="sect4" HREF="#toc4">SEE 
ALSO </A></H2>
create <A HREF="table.l.html">table (l)</A>
, <A HREF="update.l.html">update (l)</A>
. <P>

<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<LI><A NAME="toc3" HREF="#sect3">EXAMPLE</A></LI>
<LI><A NAME="toc4" HREF="#sect4">SEE ALSO</A></LI>
</UL>
</BODY></HTML>