PostgreSQL-Ni O'rnatish.
Biz avvalo postgresql ning oxirgi versiyasini yuklab olamiz, so`ngra uni quyidagicha sozlab olamiz.
Next tugmasini bosib, o`rnatishni boshlaymiz.
Bu yerda biz yuklagan postgresql 15 versiyasi ekanligi ko`rinadi. Yana next tugmasini bosamiz.
Va bizga postgresql da kerak bo`ladigan kompanentalari ko`rinadi, biz yana next tugmasini bosamiz.
Bu yerda esa biz postgresql ga kirishimiz uchun maxfiy kod qo`yamiz.
Bu yerda esa qaysi porda ishlashi keltirilgan biz yana next ni bosamiz.
Bu yerda next tugmasini bosibkeyingi jarayonga o`tishni tasdiqlaymiz.
Yana next tugmasini bosibkeyingi jarayonga o`tishni tasdiqlaymiz.
So`ngra yakuniy jarayon next tugmasini postgresql ni o`rnatish jarayoni ishga tushadi.
Bu yerda postgresql ni muvaffaqiyatli o`natilgani ko`rinib turadi.
Keyingi jarayon esa biz yuqorida ko`rgan postgresqlni pgAdmin 4 kompanentasi orqali ishlaymiz.
Biz pgAdmin 4 ga yuqoridagi parolimiz orqali kiramiz.
Bu yerda postgresql ni sever qismi keltirilgan.
Bu yerda postgresql ni sever qismi va uning qaysi versiya ekanligi keltirilgan.
Bu yerda esa postgresql ni sxemalar bo`limi keltirilgan biz bub o`lim orqali table lardan foydalanishimiz mumkin.
-- Clients Table
CREATE TABLE Clients (
ClientID SERIAL PRIMARY KEY,
FirstName VARCHAR(255),
LastName VARCHAR(255),
Email VARCHAR(255),
Phone VARCHAR(15)
);
-- Equipment Table
CREATE TABLE Equipment (
EquipmentID SERIAL PRIMARY KEY,
EquipmentType VARCHAR(255),
SerialNumber VARCHAR(255),
PurchaseDate DATE,
ClientID INT REFERENCES Clients(ClientID)
);
-- Repairs Table
CREATE TABLE Repairs (
RepairID SERIAL PRIMARY KEY,
RepairDate DATE,
Description TEXT,
Cost DECIMAL(10, 2),
EquipmentID INT REFERENCES Equipment(EquipmentID)
);
-- Software Table
CREATE TABLE Software (
SoftwareID SERIAL PRIMARY KEY,
SoftwareName VARCHAR(255),
Version VARCHAR(50),
LicenseKey VARCHAR(255)
);
-- Installations Table
CREATE TABLE Installations (
InstallationID SERIAL PRIMARY KEY,
InstallationDate DATE,
SoftwareID INT REFERENCES Software(SoftwareID),
EquipmentID INT REFERENCES Equipment(EquipmentID)
);
Table larga malumot kiritish:
-- Sample data for Clients Table
INSERT INTO Clients (FirstName, LastName, Email, Phone)
VALUES
('John', 'Doe', 'john.doe@example.com', '123-456-7890'),
('Jane', 'Smith', 'jane.smith@example.com', '987-654-3210'),
('Bob', 'Johnson', 'bob.johnson@example.com', '555-123-4567'),
('Alice', 'Williams', 'alice.williams@example.com', '777-888-9999'),
('Charlie', 'Brown', 'charlie.brown@example.com', '111-222-3333');
-- Sample data for Equipment Table
INSERT INTO Equipment (EquipmentType, SerialNumber, PurchaseDate, ClientID)
VALUES
('Laptop', 'ABC123', '2022-01-15', 1),
('Desktop', 'XYZ789', '2022-02-28', 2),
('Printer', 'DEF456', '2022-03-10', 3),
('Scanner', 'GHI789', '2022-04-05', 4),
('Server', 'JKL012', '2022-05-20', 5);
-- Sample data for Repairs Table
INSERT INTO Repairs (RepairDate, Description, Cost, EquipmentID)
VALUES
('2022-02-01', 'Broken screen', 150.00, 1),
('2022-03-15', 'Hard drive failure', 200.00, 2),
('2022-04-20', 'Paper jam', 50.00, 3),
('2022-05-10', 'Scanner not working', 100.00, 4),
('2022-06-05', 'Server crash', 300.00, 5);
-- Sample data for Software Table
INSERT INTO Software (SoftwareName, Version, LicenseKey)
VALUES
('Operating System', 'Windows 10', 'ABCDE-12345-FGHIJ-67890'),
('Office Suite', 'Microsoft Office 2022', 'QWERT-54321-ASDFG-98765'),
('Antivirus', 'Norton Antivirus', 'ZXCVB-67890-QWERT-12345');
-- Sample data for Installations Table
INSERT INTO Installations (InstallationDate, SoftwareID, EquipmentID)
VALUES
('2022-01-20', 1, 1),
('2022-02-28', 2, 2),
('2022-03-15', 3, 3),
('2022-04-05', 1, 4),
('2022-05-20', 2, 5);
Name
Workplace_id
Version
location
Purchase_date
Vendor
Software_installed
Number_license
License_type
Software
Workplace
N 1
M
License
Employee
M
License_id
Employee_id
Lisence_key
Name
Issue_date
position
Sowtware_lisense
Workplace_assined
License _type
Installation
M
Installation_id
Installation_date
Softwarare_instalation
Workplace_installed
Dostları ilə paylaş: |