“odrębny” Kod odpowiedzi

Wybierz wyraźny

SELECT DISTINCT ma_colonne
FROM nom_du_tableau
Courageous Cowfish

Zapytanie wyraźne

SELECT DISTINCT Column_name FROM table_name;
Hungry Hamster

Odrębny

CREATE TABLE Products
(
    Id INT IDENTITY PRIMARY KEY,
    ProductName NVARCHAR(30) NOT NULL,
    Manufacturer NVARCHAR(20) NOT NULL,
    ProductCount INT DEFAULT 0,
    Price MONEY NOT NULL
);
  
INSERT INTO Products 
VALUES
('iPhone 6', 'Apple', 3, 36000),
('iPhone 6S', 'Apple', 2, 41000),
('iPhone 7', 'Apple', 5, 52000),
('Galaxy S8', 'Samsung', 2, 46000),
('Galaxy S8 Plus', 'Samsung', 1, 56000),
('Mi6', 'Xiaomi', 5, 28000),
('OnePlus 5', 'OnePlus', 6, 38000)

SELECT AVG(Price) AS Average_Price FROM Products
SELECT AVG(Price) FROM Products
WHERE Manufacturer='Apple'
SELECT AVG(Price * ProductCount) FROM Products
SELECT COUNT(Manufacturer) FROM Products
SELECT MIN(Price) FROM Products
SELECT MAX(Price) FROM Products
SELECT SUM(ProductCount) FROM Products
SELECT AVG(DISTINCT ProductCount) AS Average_Price FROM Products
SELECT AVG(ALL ProductCount) AS Average_Price FROM Products
Info Important

odrębny

Syntax of Distinct in SQL

SELECT DISTINCT column_name  
FROM table_name  
[WHERE condition];
Super Stag

Odpowiedzi podobne do “odrębny”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu