Community chat: https://t.me/hamster_kombat_chat_2
Website: https://hamster.network
Twitter: x.com/hamster_kombat
YouTube: https://www.youtube.com/@HamsterKombat_Official
Bot: https://t.me/hamster_kombat_bot
Last updated 5 days, 21 hours ago
Your easy, fun crypto trading app for buying and trading any crypto on the market.
📱 App: @Blum
🤖 Trading Bot: @BlumCryptoTradingBot
🆘 Help: @BlumSupport
💬 Chat: @BlumCrypto_Chat
Last updated 5 months, 3 weeks ago
Turn your endless taps into a financial tool.
Join @tapswap_bot
Collaboration - @taping_Guru
Last updated 2 weeks, 6 days ago
SELECT setval('track_codes_id_seq', 11062);
shu yerda turib tursin. Birozdan keyiin tushuntirib yozvoraman!
sql CREATE TABLE customers( customer_id INT GENERATED ALWAYS AS IDENTITY, customer_name VARCHAR(255) NOT NULL, PRIMARY KEY(customer_id) ); CREATE TABLE contacts( contact_id INT GENERATED ALWAYS AS IDENTITY, customer_id INT, contact_name…
```
sql
CREATE TABLE customers(
customer_id INT GENERATED ALWAYS AS IDENTITY,
customer_name VARCHAR(255) NOT NULL,
PRIMARY KEY(customer_id)
);
CREATE TABLE contacts(
contact_id INT GENERATED ALWAYS AS IDENTITY,
customer_id INT,
contact_name VARCHAR(255) NOT NULL,
phone VARCHAR(15),
email VARCHAR(100),
PRIMARY KEY(contact_id),
CONSTRAINT fk_customer
FOREIGN KEY(customer_id)
REFERENCES customers(customer_id)
ON DELETE SET NULL
);
```
CREATE TABLE IF NOT EXISTS products ( id SERIAL PRIMARY KEY , name VARCHAR(50) UNIQUE NOT NULL , price INT NOT NULL ); CREATE TABLE IF NOT EXISTS products_history( id INT , name VARCHAR(50) NOT NULL , price INT NOT NULL , status…
```
CREATE TABLE IF NOT EXISTS products (
id SERIAL PRIMARY KEY ,
name VARCHAR(50) UNIQUE NOT NULL ,
price INT NOT NULL
);
CREATE TABLE IF NOT EXISTS products_history(
id INT ,
name VARCHAR(50) NOT NULL ,
price INT NOT NULL ,
status VARCHAR(15) NOT NULL ,
created_at TIMESTAMP DEFAULT current_timestamp
);
CREATE OR REPLACE FUNCTION update_products_history()
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO products_history (id, name, price, status)
VALUES (
coalesce(NEW.id, old.id),
COALESCE(NEW.name, OLD.name),
COALESCE(NEW.price, OLD.price),
CASE
WHEN TG_OP = 'INSERT' THEN 'INSERT'
WHEN TG_OP = 'UPDATE' THEN 'UPDATE'
WHEN TG_OP = 'DELETE' THEN 'DELETE'
END
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER products_history_trigger
AFTER INSERT OR UPDATE OR DELETE
ON products
FOR EACH ROW
EXECUTE FUNCTION update_products_history();
create or replace procedure insert_product(
name varchar,
price int
)
language plpgsql
as $$
begin
INSERT INTO products(name, price) VALUES (name, price*100);
commit;
end;$$;
call insert_product('Banana', 5);
INSERT INTO products(name, price) VALUES ('Phone23455', 5000);
DELETE FROM products WHERE id=3;
```
Community chat: https://t.me/hamster_kombat_chat_2
Website: https://hamster.network
Twitter: x.com/hamster_kombat
YouTube: https://www.youtube.com/@HamsterKombat_Official
Bot: https://t.me/hamster_kombat_bot
Last updated 5 days, 21 hours ago
Your easy, fun crypto trading app for buying and trading any crypto on the market.
📱 App: @Blum
🤖 Trading Bot: @BlumCryptoTradingBot
🆘 Help: @BlumSupport
💬 Chat: @BlumCrypto_Chat
Last updated 5 months, 3 weeks ago
Turn your endless taps into a financial tool.
Join @tapswap_bot
Collaboration - @taping_Guru
Last updated 2 weeks, 6 days ago