Subtables (newbie)

This is a discussion on Subtables (newbie) within the MySQL Database forums, part of the Database Forums category; Hi all: Suppose that I have a table called library concerning the books from a library. If I type SELECT ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-02-2006
José Carlos Santos
 
Posts: n/a
Default Subtables (newbie)

Hi all:

Suppose that I have a table called library concerning the books from a
library. If I type

SELECT title, author FROM library;

I get the two columns of the table which contain the titles and the
authors. Is it possible to save this as another table?

In other words, I would like to now how to extract a subtable from a
table.

Best regards,

Jose Carlos Santos
Reply With Quote
  #2 (permalink)  
Old 05-02-2006
Jerry Stuckle
 
Posts: n/a
Default Re: Subtables (newbie)

José Carlos Santos wrote:
> Hi all:
>
> Suppose that I have a table called library concerning the books from a
> library. If I type
>
> SELECT title, author FROM library;
>
> I get the two columns of the table which contain the titles and the
> authors. Is it possible to save this as another table?
>
> In other words, I would like to now how to extract a subtable from a
> table.
>
> Best regards,
>
> Jose Carlos Santos



http://dev.mysql.com/doc/refman/5.1/...ate-table.html
http://dev.mysql.com/doc/refman/5.1/...rt-select.html

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #3 (permalink)  
Old 05-02-2006
José Carlos Santos
 
Posts: n/a
Default Re: Subtables (newbie)

On 02-05-2006 12:25, Jerry Stuckle wrote:

>> Suppose that I have a table called library concerning the books from a
>> library. If I type
>>
>> SELECT title, author FROM library;
>>
>> I get the two columns of the table which contain the titles and the
>> authors. Is it possible to save this as another table?
>>
>> In other words, I would like to now how to extract a subtable from a
>> table.

>
> http://dev.mysql.com/doc/refman/5.1/...ate-table.html
> http://dev.mysql.com/doc/refman/5.1/...rt-select.html


Thinks. I did a search at http://dev.mysql.com/doc/refman/5.1/en/ before
posting here, but using the word "subtable". I didn't know that the
magic word was "insert".

Best regards,

Jose Carlos Santos
Reply With Quote
  #4 (permalink)  
Old 05-02-2006
Axel Schwenke
 
Posts: n/a
Default Re: Subtables (newbie)

=?ISO-8859-1?Q?Jos=E9_Carlos_Santos?= <jcsantos@fc.up.pt> wrote:

> Suppose that I have a table called library concerning the books from a
> library. If I type
>
> SELECT title, author FROM library;
>
> I get the two columns of the table which contain the titles and the
> authors. Is it possible to save this as another table?
>
> In other words, I would like to now how to extract a subtable from a
> table.


In SQL there is no concept like a SUBTABLE. But there is a thing called
a VIEW which can be seen as kind of a subtable. Example:

CREATE VIEW library_short AS SELECT title, author FROM library;

would create the VIEW `library_short`, containing the `title` and
`author` columns from table `library`. This VIEW could be used just
like an ordinary table in your SQL statements.

SELECT * FROM library_short WHERE author LIKE '%Goethe%';

For more details on VIEWs, please consult the MySQL manual and/or
a SQL textbook of your choice.


HTH, XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:37 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0