👤
Home Man
Search
Today's Posts
Register

Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

SQL - how to alter info of a cell in table

Tags
solved, sql

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 02-18-2016
SQL - how to alter info of a cell in table

Hello,
I am newbie on mysql and trying to edit my database from terminal under linux.
What I need to do is to change the information written in a cell in table.
Let me explain what I tried:

Code:
$ mysql -u mysqluser -p
$ show databases;
$ USE catalogue;
$ show tables ;
$ select * from phonebook;

it shows something like this:

+-------------+------------+--------+
| id | friend_name | age |
+-------------+------------+--------+
| 1 | Jaxier | 18 |
| 2 | Johanna | 26 |
| 3 | Johny | 25 |
| 4 | Lacatus | 18 |
| 5 | Julia | 25 |
+-------------+------------+---------+

What I want to do is to set age of Lacatus from 18 to 58

I tried below commands:

1)
Code:
$ update phonebook set id 4 SET age 58;

gives syntax error.

2)
Code:
$  ALTER phonebook ALTER id ALTER 4 SET age 58;

I 'd appreciate if you could explain what I should run in terminal


Thanks in advance
Boris
# 2  
Old 02-18-2016
The mysql-documentation tells you in detail how to formulate the statment. For you example, if you'd like to change Lacatus age to 58 it would look like this:
Code:
update phonebook set age = 58 where id = 4;

The Following User Says Thank You to cero For This Useful Post:
baris35 (02-18-2016)
# 3  
Old 02-18-2016
Quote:
Originally Posted by cero
The mysql-documentation tells you in detail how to formulate the statment. For you example, if you'd like to change Lacatus age to 58 it would look like this:
Code:
update phonebook set age = 58 where id = 4;


Voila! It's done! Thanks for your reply Cero.
I will also check that mysql documentation for other functions.

b.regards
Boris
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Putting query result dynamically to one cell of table from shell meera_123 UNIX for Beginners Questions & Answers 2 08-10-2016 04:21 AM
SQL QUERY to Table Output tharmendran Solaris 2 03-17-2015 03:17 PM
SQL: Alter existing bool after printing sea Programming 3 03-05-2014 10:16 AM
How to get full sql table data using shell script ss135r Shell Programming and Scripting 1 08-30-2011 08:32 AM
my SQL Info command runnerpaul SuSE 1 06-28-2011 06:35 AM
Alter Table Shell Script ankitgupta Shell Programming and Scripting 2 10-06-2006 06:01 AM


All times are GMT -4. The time now is 06:18 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password