Posts

Showing posts from July, 2026

DATABASE CASE | TRANSACTION | HAVING

 SELECT City, SUM(Salary) as TotalSalary FROM Employee GROUP BY City HAVING City = 'MUMBAI' ======================================================================================= CREATE TABLE Product ( ProductID INT PRIMARY KEY, Name VARCHAR(40), Price INT, Quantity INT ) INSERT INTO Product VALUES(101, 'Product-1', 100, 10) INSERT INTO Product VALUES(102, 'Product-2', 200, 15) INSERT INTO Product VALUES(103, 'Product-3', 300, 20) INSERT INTO Product VALUES(104, 'Product-4', 400, 25) Transaction Statement BEGIN TRANSACTION INSERT INTO Product VALUES(105,'Product-5',500, 30) UPDATE Product SET Price =350 WHERE ProductID = 103 DELETE FROM Product WHERE ProductID = 103 COMMIT TRANSACTION rollback  ========================================================================================= SELECT Name, Age,  CASE  WHEN Age < 18 THEN 'Minor'  WHEN Age >= 18 AND Age < 60 THEN 'Adult'  ELSE 'Senior'  END AS AgeGrou...

Numpy

 No file chosenNo file chosenNo file chosen Chat with ChatGPT Ask anything ChatGPT is AI and can make mistakes. Log in You said: Numpy python example with results ChatGPT said: Here are a few common NumPy examples with their outputs. 1. Create a NumPy array import numpy as np arr = np.array([10, 20, 30, 40, 50]) print(arr) Output: [10 20 30 40 50] 2. Basic arithmetic import numpy as np arr = np.array([1, 2, 3, 4]) print("Original:", arr) print("Add 5:", arr + 5) print("Multiply by 2:", arr * 2) Output: Original: [1 2 3 4] Add 5: [6 7 8 9] Multiply by 2: [2 4 6 8] 3. Array statistics import numpy as np arr = np.array([10, 20, 30, 40, 50]) print("Sum:", np.sum(arr)) print("Mean:", np.mean(arr)) print("Maximum:", np.max(arr)) print("Minimum:", np.min(arr)) Output: Sum: 150 Mean: 30.0 Maximum: 50 Minimum: 10 4. 2D array (matrix) import numpy as np matrix = np.array([[1, 2, 3],                    [4, 5, 6]]) print(matrix)...