Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> atrybut PK auto_increment
moherek93
post 29.11.2012, 15:15:17
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 14.11.2012

Ostrzeżenie: (0%)
-----


jak wygląda polecenie zwiększające wartość o 2, np pole ID w tabeli?
Primaty KEY auto-increment zwiększa wartośc o 1...

oraz jak umieścić w tabeli wiele wierszy poleceniem SQL?
nerdsmiley.png
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
viking
post 29.11.2012, 15:18:59
Post #2





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


http://dev.mysql.com/doc/refman/5.6/en/rep...ement_increment
http://dev.mysql.com/doc/refman/5.6/en/insert.html


--------------------
Go to the top of the page
+Quote Post
moherek93
post 29.11.2012, 15:26:03
Post #3





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 14.11.2012

Ostrzeżenie: (0%)
-----


szkoda że nie po polsku, bo nic nie kumam
tak będzie wygladał polecenie zwiększajace o 2 "auto-increment[=2]"
Go to the top of the page
+Quote Post
viking
post 29.11.2012, 15:40:31
Post #4





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


http://translate.google.com/
Jak dokumentacji nie kumasz nie masz przyszłości w tej branży wink.gif


--------------------
Go to the top of the page
+Quote Post
moherek93
post 29.11.2012, 16:13:35
Post #5





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 14.11.2012

Ostrzeżenie: (0%)
-----


za to TY jesteś bardzo pomocny thumbsdownsmileyanim.gif
Go to the top of the page
+Quote Post
skowron-line
post 29.11.2012, 16:20:48
Post #6





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

Ostrzeżenie: (0%)
-----


Cytat(moherek93 @ 29.11.2012, 15:26:03 ) *
szkoda że nie po polsku, bo nic nie kumam
tak będzie wygladał polecenie zwiększajace o 2 "auto-increment[=2]"

Patrz na przykłady
Cytat
mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
+--------------------------+-------+
2 rows in set (0.00 sec)

mysql> CREATE TABLE autoinc1
-> (col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
Query OK, 0 rows affected (0.04 sec)

mysql> SET @@auto_increment_increment=10;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 10 |
| auto_increment_offset | 1 |
+--------------------------+-------+
2 rows in set (0.01 sec)

mysql> INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> SELECT col FROM autoinc1;
+-----+
| col |
+-----+
| 1 |
| 11 |
| 21 |
| 31 |
+-----+
4 rows in set (0.00 sec)


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
alegorn
post 29.11.2012, 17:20:50
Post #7





Grupa: Zarejestrowani
Postów: 341
Pomógł: 40
Dołączył: 23.06.2009

Ostrzeżenie: (0%)
-----


mi sie wydaje, czy tez to idzie dla calej bazy... ?, jesli tak to mozna sie niezle zdziwic..... wink.gif

j.

edit: sprawdzilem.... nie tylko per baza ale per SERWER.....


Ten post edytował alegorn 29.11.2012, 17:23:49
Go to the top of the page
+Quote Post
mmmmmmm
post 29.11.2012, 20:30:55
Post #8





Grupa: Zarejestrowani
Postów: 1 421
Pomógł: 310
Dołączył: 18.04.2012

Ostrzeżenie: (0%)
-----


Nie zadałeś najważniejszego pytania: po co?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 27.06.2025 - 01:08