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 05:21 AM
alter data in a file gaddamja UNIX for Dummies Questions & Answers 2 03-10-2011 06:31 AM
alter data in column tintin72 UNIX for Dummies Questions & Answers 2 04-02-2009 08:40 AM
rearrange info of file in a "table" csecnarf Shell Programming and Scripting 5 06-13-2008 12:59 PM
Can't alter bootlist mooshkie AIX 2 01-28-2008 10:12 AM
Alter Table Shell Script ankitgupta Shell Programming and Scripting 2 10-06-2006 07:01 AM


All times are GMT -4. The time now is 02:11 PM.

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