consider columns
name,sname,id. i want id to be first in mysql

Recommended Answers

All 9 Replies

select id,name,sname from yourtablename

so simple yaar

you didnt get it. i want to change column id position from 3 to first

how to rename a column in mysql

In a database, the order of the columns in the table is TOTALLY irrelevant. The same is true for the order of the rows. This is an important basic concept in relational databases.

In other words it just doesn't matter at all, you write your query and STATE the columns you wish to be working with, in whatever order suits yours query.

eg table people with columns address, firstName id, town, surname, age, postcode/zipcode can be queried in any order you choose, such as
select id, surname, firstName, address, town postcode/zipcode from people.
or
select age, firstName, surname, town from people.

consider:
form
id,username,age,etc
if i enterid,all other fields should get automatically filled. can anyone suggest good sites for php,sql,etc

also can anyone ttell how to start a new thread..

consider:
form
id,username,age,etc
if i enterid,all other fields should get automatically filled. can anyone suggest good sites for php,sql,etc

www.w3schools.com
www.tizag.com

That's what I used to learn about PHP and mySQL.
w3schools might be better for it because it shows them combined.

Hi, According to me you want output like that form table
"SELECT id,name,sname FROM Table_name";
But I have doubt in mention query, then please mention your query in proper way,Only then I'll Help you, with efficient way.

For that qyery you follow the concept of Alias, & here I mention a simple sql query,

"SELECT First_Name AS F_Name, Last_Name AS L_Name, Annual_Salary Package From Table_Name";

note here we use AS Keyword, but that's not Compulsory see carefully that Query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.