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>RENAME(SQL) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="sql.html">SQL Reference Contents</A>
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
rename - rename a class or an attribute in a class
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2>
<B>alter
table </B> classname1 <BR>
<B>rename to </B> classname2 <BR>
<B>alter table </B> classname1
[<B>* </B>] <BR>
<B>rename [column] </B> attname1 <B>to </B> attname2 <BR>
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
The
<B>rename</B> command causes the name of a class or attribute to change without
changing any of the data contained in the affected class. Thus, the class
or attribute will remain of the same type and size after this command
is executed. <P>
In order to rename an attribute in 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 renamed in any of the subclasses.)
This should <B>always</B> be done when changing an attribute name in 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 (in effect) missing
an attribute found in the superclass. <P>
You must own the class being modified
in order to rename it or part of its schema. Renaming any part of the
schema of a system catalog is not permitted.
<H2><A NAME="sect3" HREF="#toc3">EXAMPLE </A></H2>
-- <BR>
-- change the emp
class to personnel <BR>
-- <BR>
alter table emp rename to personnel <BR>
-- <BR>
-- change the
sports attribute to hobbies <BR>
-- <BR>
alter table emp rename column sports to
hobbies <BR>
-- <BR>
-- make a change to an inherited attribute <BR>
-- <BR>
alter table person
* rename column last_name to family_name <BR>
<H2><A NAME="sect4" HREF="#toc4">BUGS </A></H2>
Execution of historical
queries using classes and attributes whose names have changed will produce
incorrect results in many situations. <P>
Renaming of types, operators, rules,
etc., should also be supported. <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">BUGS</A></LI>
</UL>
</BODY></HTML>
|