vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure this is the right NG for my question - but here it goes: I want to add fields to an existing database. If I do an "insert" of a text file using phpmyadmin will that ADD the fields to the database, or will it OVERWRITE the database altogether? Thanks... Dave |
| |||
| dave wrote: > Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure this is the > right NG for my question - but here it goes: > > I want to add fields to an existing database. If I do an "insert" of a text > file using phpmyadmin will that ADD the fields to the database, or will it > OVERWRITE the database altogether? > > Thanks... > > Dave > > > Hi, Dave, No problem with being new, and yes, this is the correct place. INSERT just adds one or more new rows to the existing table. UPDATE will alter zero or more rows, and DELETE will remove zero or more rows - both depending on the WHERE clause. Since you're new to it, I suggest you pick up a decent book on basic SQL from the bookstore or a library. SQL is a language all unto itself, and there are a lot of things you can do with it. Alternatively, you can look for SQL tutorials on the web, but I don't have any references to good ones at the moment. Maybe someone else can pop in here. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |||
| On Tue, 4 Dec 2007 10:07:29 -0800, dave wrote: > Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure this is the > right NG for my question - but here it goes: > > I want to add fields to an existing database. If I do an "insert" of a text > file using phpmyadmin will that ADD the fields to the database, or will it > OVERWRITE the database altogether? Uhm, I'm having some vocabulary issues figuring out what you're asking exactly, but if I'm guessing right, the answer you're looking for is "Older data in a table is not cleared when data is loaded into a table. What happens to duplicated records (by unique key) depends on what you instruct the load to do; they might ignore the new data, they might replace the old row, or they might set an error and abort the load midway." -- Is it just me, or is it a clear indication that a thread is ending its useful life is when people start debating the merits of the analogies that have been posed rather than the original subject matter of the thread? --Rhetorical question by Rainer Atkins founding "Atkins' Law" |
| |||
| dave wrote: > Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure this > is the right NG for my question - but here it goes: > > I want to add fields to an existing database. If I do an "insert" of > a text file using phpmyadmin will that ADD the fields to the > database, or will it OVERWRITE the database altogether? > > Thanks... > > Dave Hi Dave, as Peter mentioned, you need to get your vocabulary straight. Fields are columns in a table. A collection of data fields/columns is called a row. You can add fields (i.e. add another column) to a table, but this is rarely done. More often you add/delete/update the data in the rows. |
| |||
| "Paul Lautman" <paul.lautman@btinternet.com> wrote in message news:5rlpe7F15f8v1U1@mid.individual.net... > dave wrote: >> Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure this >> is the right NG for my question - but here it goes: >> >> I want to add fields to an existing database. If I do an "insert" of >> a text file using phpmyadmin will that ADD the fields to the >> database, or will it OVERWRITE the database altogether? >> >> Thanks... >> >> Dave > > Hi Dave, > as Peter mentioned, you need to get your vocabulary straight. > > Fields are columns in a table. > A collection of data fields/columns is called a row. > > You can add fields (i.e. add another column) to a table, but this is > rarely done. > > More often you add/delete/update the data in the rows. Right - clear questions defintiely get clearer answers. Let me try again with the (hopefully) correct terminology... Looking back at what I'm trying to do - I'm not even sure that inserting/importing is what it is. So... ....I have an existing database (I'm using oscommerce), with many existing columns and rows. I want to add an oscommerce module, and as part of that, they are asking me to " Use a database editor (e.g., phpMyAdmin) to alter your database (or use the included sql file price-break_v1_2_0.sql instead):" alter table products add column products_price1 decimal(15,4) not null default 0.0; alter table products add column products_price2 decimal(15,4) not null default 0.0; alter table products add column products_price3 decimal(15,4) not null default 0.0; alter table products add column products_price4 decimal(15,4) not null default 0.0; alter table products add column products_price5 decimal(15,4) not null default 0.0; alter table products add column products_price6 decimal(15,4) not null default 0.0; alter table products add column products_price7 decimal(15,4) not null default 0.0; alter table products add column products_price8 decimal(15,4) not null default 0.0; alter table products add column products_price1_qty int not null default 0; alter table products add column products_price2_qty int not null default 0; alter table products add column products_price3_qty int not null default 0; alter table products add column products_price4_qty int not null default 0; alter table products add column products_price5_qty int not null default 0; alter table products add column products_price6_qty int not null default 0; alter table products add column products_price7_qty int not null default 0; alter table products add column products_price8_qty int not null default 0; alter table products add column products_qty_blocks int not null default 1; So I guess I want to "alter" my database? Hmmm.... Definitely delving into areas where maybe I ought not to... Thanks guys..! |
| |||
| dave wrote: > "Paul Lautman" <paul.lautman@btinternet.com> wrote in message > news:5rlpe7F15f8v1U1@mid.individual.net... >> dave wrote: >>> Hi, I'm a complete novice wtih mysql, and I'm not even 100% sure >>> this is the right NG for my question - but here it goes: >>> >>> I want to add fields to an existing database. If I do an "insert" of >>> a text file using phpmyadmin will that ADD the fields to the >>> database, or will it OVERWRITE the database altogether? >>> >>> Thanks... >>> >>> Dave >> >> Hi Dave, >> as Peter mentioned, you need to get your vocabulary straight. >> >> Fields are columns in a table. >> A collection of data fields/columns is called a row. >> >> You can add fields (i.e. add another column) to a table, but this is >> rarely done. >> >> More often you add/delete/update the data in the rows. > > Right - clear questions defintiely get clearer answers. Let me try > again with the (hopefully) correct terminology... > > Looking back at what I'm trying to do - I'm not even sure that > inserting/importing is what it is. So... > > ...I have an existing database (I'm using oscommerce), with many > existing columns and rows. I want to add an oscommerce module, and as > part of that, they are asking me to " Use a database editor (e.g., > phpMyAdmin) to alter your database (or use the included sql file > price-break_v1_2_0.sql instead):" > > alter table products add column products_price1 decimal(15,4) not null > default 0.0; > alter table products add column products_price2 decimal(15,4) not null > default 0.0; > alter table products add column products_price3 decimal(15,4) not null > default 0.0; > alter table products add column products_price4 decimal(15,4) not null > default 0.0; > alter table products add column products_price5 decimal(15,4) not null > default 0.0; > alter table products add column products_price6 decimal(15,4) not null > default 0.0; > alter table products add column products_price7 decimal(15,4) not null > default 0.0; > alter table products add column products_price8 decimal(15,4) not null > default 0.0; > alter table products add column products_price1_qty int not null > default 0; alter table products add column products_price2_qty int > not null default 0; alter table products add column > products_price3_qty int not null default 0; alter table products add > column products_price4_qty int not null default 0; alter table > products add column products_price5_qty int not null default 0; alter > table products add column products_price6_qty int not null default 0; > alter table products add column products_price7_qty int not null > default 0; alter table products add column products_price8_qty int > not null default 0; alter table products add column > products_qty_blocks int not null default 1; > So I guess I want to "alter" my database? Hmmm.... Definitely > delving into areas where maybe I ought not to... > > Thanks guys..! OK, this is the "rarely done" thing that I mentioned. All it'll do is add new columns/fields to your existing records. Since they won't have had data put in them, they will inherit the default values mentioned in the list above. None of the existing data will be lost. |
| ||||
| On Tue, 4 Dec 2007 12:36:43 -0800, dave wrote: > Right - clear questions defintiely get clearer answers. Let me try again > with the (hopefully) correct terminology... > > Looking back at what I'm trying to do - I'm not even sure that > inserting/importing is what it is. So... > > ...I have an existing database (I'm using oscommerce), with many existing > columns and rows. I want to add an oscommerce module, and as part of that, > they are asking me to " Use a database editor (e.g., phpMyAdmin) to alter > your database (or use the included sql file price-break_v1_2_0.sql > instead):" Oh, much better.... > > alter table products add column products_price1 decimal(15,4) not null > default 0.0; > alter table products add column products_price2 decimal(15,4) not null > default 0.0; > alter table products add column products_price3 decimal(15,4) not null > default 0.0; > alter table products add column products_price4 decimal(15,4) not null > default 0.0; > alter table products add column products_price5 decimal(15,4) not null > default 0.0; > alter table products add column products_price6 decimal(15,4) not null > default 0.0; > alter table products add column products_price7 decimal(15,4) not null > default 0.0; > alter table products add column products_price8 decimal(15,4) not null > default 0.0; > alter table products add column products_price1_qty int not null default 0; > alter table products add column products_price2_qty int not null default 0; > alter table products add column products_price3_qty int not null default 0; > alter table products add column products_price4_qty int not null default 0; > alter table products add column products_price5_qty int not null default 0; > alter table products add column products_price6_qty int not null default 0; > alter table products add column products_price7_qty int not null default 0; > alter table products add column products_price8_qty int not null default 0; > alter table products add column products_qty_blocks int not null default 1; > > So I guess I want to "alter" my database? Hmmm.... Definitely delving into > areas where maybe I ought not to... Yup! Alter is what you want. Each of the lines above is a command to alter (change) a table (products) to add a column named whatever of a particular type, disallowing that the column can be null, and providing a (possibly redundant) default value. So, the next question is do you ave some kind of access to your databse that would allow you to make changes to tables, such as the mysqlp command line interface, or phpMyAdmin, or SQLYog, or anything else? -- Technical points aside, you could probably beat someone to death with a Newton if you had to. Try that with a Palm Pilot! --Dan Duncan in comp.sys.newton.misc |
| Thread Tools | |
| Display Modes | |
|
|