Unstoppable Domains

Changing the database structure

Spaceship Spaceship
Watch

abc123ben

Established Member
Impact
2
Hello,

Again, I am in need of MySQL help. I am new to PHP & MySQL, and reading a PHP & MySQL book to try and learn PHP & MySQL. And at the moment I am reading about changing the database structure. Here is an example:

1) ALTER columnname SET DEFAULT value (What is this?)

And this, what is this query used for, I mean the value bit, I know it adds rows to a database:

2) INSERT INTO tablename (columnname, columnname)
VALUES (value, value)

As I said, I'm very new to PHP & MySQL, so any help will be appreciated! :)
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
This is the query to alter that is to change the default value of a particular column.
 
0
•••
And what sort of values would you store in a column? If you get what I mean.

Also, I modified the post:

And this, what is this query used for, I mean the value bit, I know it adds rows to a database:

2) INSERT INTO tablename (columnname, columnname)
VALUES (value, value)

I'm very new to this, so I would appreciate any help :p.
 
0
•••
Code:
Q. And what sort of values would you store in a column? If you get what I mean.

Ans. You can store the value in the column according to the column's data type.
______________________

Q. INSERT INTO tablename (columnname, columnname) VALUES (value, value)

Ans. I would first of all like to modify the above query first.
INSERT INTO tablename (columnname1, columnname2) VALUES (value1, value2)

Now this query will insert the value1 in column1 and value2 in column2

Thanks.
 
0
•••
Sorry to be a pain, but I have one more question:

DEFAULT value

What I'm trying to ask is, if you used the above definition, will that value be stored in any row, if a row is made in that column? Or..?
 
0
•••
Yes the value will be stored in all rows created, unless ... a value for that column is specified in the insert statement.

This is a very useful facility especially if your tables have lots of columns - you won't need to specify all the columns in the insert statement.

Seems like you are getting to grips with it all!

Mike
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back