Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add another field in an existing table in mysql

Okay, I have these table table1

and I also have another table right here:

enter image description here

So,idAlbum is in the gallery table, what is the query for this? I want to select the data from one field in one table and insert it into a field in another table.

like image 987
woninana Avatar asked Jun 07 '11 02:06

woninana


People also ask

How do I add multiple columns to an existing table in MySQL?

In MySQL, to add a new column to an existing table, the ALTER TABLE syntax would look like this: ALTER TABLE table_name ADD COLUMN column_name column_definition; Let's try adding multiple columns in one command. If you found value in this post, you can show your appreciation and buy me a coffee.

How do I edit an existing table in MySQL?

To access the MySQL Table Editor, right-click a table name in the Navigator area of the sidebar with the Schemas secondary tab selected and click Alter Table. This action opens a new secondary tab within the main SQL Editor window.

How do you add a new column to an existing column in SQL?

In Microsoft SQL Server, we can change the order of the columns and can add a new column by using ALTER command. ALTER TABLE is used to add, delete/drop or modify columns in the existing table. It is also used to add and drop various constraints on the existing table.


1 Answers

If you want to add a field in existing table in PhpMyAdmin, click "Structure" tab while viewing its data, and at the bottom of table structure you have nice box: "Add [number] fields at the [beginning / ending] of a table. Click the button on the right and processd with forms.

like image 61
Tomasz Kowalczyk Avatar answered Sep 30 '22 03:09

Tomasz Kowalczyk