Jump to content

Repostion a row.


redarrow

Recommended Posts

Advance thank you.

 

I am going over all the mysql i no and i come accros a problam.

 

I forgot how to repostion a row once it set in the database.

 

I am using the mysql command prompt to learn properly.

 


//1 create a database


create database users;

// use the database 

use users;

// create a table

create table members(name varchar (20) not null,
                 address varchar(100) not null,
                 telephone_number int(20) not null,
                id int not null auto_increment primary key);

 

So i got now.

 

name

address

telephone_number

id

 

know the hard bit not found in the mysql manual how to postion the id to the first row?

 

bad example but funny but also hard to work out.

mysql>> alter table users modify id int not null auto_increment primary key postion row 1

 

Dont no gong mad lol.

 

Link to comment
Share on other sites

Hi...

 

U actually need to rename each filed

 

See the code as below ...........

 

Changing ID to ID1

 

ALTER TABLE `employee` CHANGE `id` `id1` int not null auto_increment primary key

Changin NAME to ID

ALTER TABLE `employee` CHANGE `name` `id` int not null auto_increment primary key

CHaning ID1 to Name

 

ALTER TABLE `employee` CHANGE `id1` `name` varchar (20) not null,

 

 

 

Like this U need to do ..

 

So that u r data will not lost

 

 

 

Regards

Sushant

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.