nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Mysql how to specify select columns

This is a discussion on Mysql how to specify select columns within the Databases servers forums, part of the Mastering Servers category; Dear All, I am new to MySQL and SQL coding. Just wondering how do I display some (selected) or all ...


Go Back   nixCraft Linux Forum > Mastering Servers > Databases servers

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-19-2006, 01:08 AM
raj raj is offline
Contributors
User
 
Join Date: Jun 2005
Location: Hyderabad
Posts: 146
Rep Power: 4
raj is on a distinguished road
Default Mysql how to specify select columns

Dear All,

I am new to MySQL and SQL coding. Just wondering how do I display some (selected) or all of the columns from a table. All I wanted to do is to force mysql select column. But I don't know linux mysql client commend.

Regards
__________________
Raj
Linux rulz.
I have never turned back in my life ; I shall not do so today.. haha
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-19-2006, 01:15 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 910
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

MySQL SQL SELECT command is used to retrieve rows selected from one or more tables. It allows you to select mysql table columns.

Login to MySQL
Code:
mysql -u user -p databasename
If your table name is books, to select all columns type command:
Code:
SELECT * FROM books;
Using * is easy, you an specify the column name with following command (let us say column name is author and email):
Code:
SELECT autor, email FROM books;
For more information please see SELECT command syntax
http://dev.mysql.com/doc/refman/5.0/en/select.html
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 12-19-2006, 01:23 AM
raj raj is offline
Contributors
User
 
Join Date: Jun 2005
Location: Hyderabad
Posts: 146
Rep Power: 4
raj is on a distinguished road
Default

Thanks for quick reply and yup, SELECT autor, email FROM books; did the trick for me.

This is what I am using:
Code:
SELECT puser, email FROM mailinglist;
I am looking at syntax mysql site.
__________________
Raj
Linux rulz.
I have never turned back in my life ; I shall not do so today.. haha
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)

 
Thread Tools
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Create output in columns rakeshrhn Shell scripting 5 12-07-2007 06:27 PM
Select specific rows c341 Shell scripting 6 01-18-2007 02:04 AM
help me in editing this columns sureshbup Shell scripting 1 12-12-2006 02:29 PM
rearranging columns in a text file sureshbup Shell scripting 2 12-06-2006 09:43 AM
Calculations across different lines & columns of a file Guest Shell scripting 2 09-16-2005 04:18 AM


All times are GMT +5.5. The time now is 04:49 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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