Re: [SQL] Re: [GENERAL] Still the problem with the autoincrement field

Поиск
Список
Период
Сортировка
От James Oden
Тема Re: [SQL] Re: [GENERAL] Still the problem with the autoincrement field
Дата
Msg-id 01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us
обсуждение исходный текст
Список pgsql-sql
|
|So, what you should do is:
|
|INSERT INTO offene_stellen (
|    bezeichnung,
|    arbeitsort,
|    berater
|    gefordert
|    geboten
|)
|VALUES (
|    'Maurer',
|    'Buchs',
|    'Rheinhalter Claudio',
|    'flexibilitaet',
|    'gutes Team'
|);
|
|This works, and it also makes sure that if you change the schema such that
|the order of the fields is different or there are new fields between the
|existing fields, the query won't break.

Also, if you are working with a program where the user may want to updated
only certain fields you can do that without paying any attention to the
order of the fields in the table.  I tried to do it the other way with NULLs
and such, and its just a real hassle once you change the the structure of
the database to go back and make your code conform to the new structure.

|
|But if you insist on not mentioning field names, I think inserting a NULL
|rather than a value in the id field should work. I won't swear on it,

It works, but I definately agree with Herouth...don't do it...its a bad
idea.  You will save yourself much work in the long run if you just include
the column names in the update query, and besides if you are embedding this
query in a program there should be no problem at all. You type the query
once, and provided you typed it correctly, forget about it.

...james


В списке pgsql-sql по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [GENERAL] Still the problem with the autoincrement field
Следующее
От: "Gemeinschaft Studienarbeit Datenbanken"
Дата:
Сообщение: select-querries out of an array?