Database ve SQL Temelleri

29 Mart – 2 Nisan 2027

Ders Notu

database → tables → rows → columns
  • primary key: satırı benzersiz tanımlar
  • auto increment: yeni id değerini artırır
  • unique: tekrarlanmasını istemediğimiz değer
  • null: değerin bulunmaması; boş string ile aynı değildir

CRUD

INSERT INTO products (name, sku, price, stock)
VALUES ('Kablosuz Mouse', 'MOU-101', 650.00, 12);

SELECT id, name, price
FROM products
WHERE is_active = 1
ORDER BY price DESC
LIMIT 5;

UPDATE products
SET stock = 8
WHERE id = 1;

DELETE FROM products
WHERE id = 1;

UPDATE/DELETE öncesi aynı WHERE ile SELECT yap ve hedef satırı doğrula.

Debug: seçili database → table adı → column adı → syntax error mesajındaki yakın bölüm → WHERE koşulu.

Bu hafta normalization teorisi yoktur. Amaç SQL yazarak gerçek tabloyu oluşturmak ve veriyi değiştirmektir.