Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MY SQL
--Sql Server 2014 Express Edition --Batches are separated by 'go' select @@version as 'sql server version' /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text, salary numeric, mobile numeric, designation text); /* Create few records in this table */ INSERT INTO NAMES VALUES(1,'BHARTI','22700','70114','helpdesk'); INSERT INTO NAMES VALUES(2,'MUKESH','22700','81300','helpdesk'); INSERT INTO NAMES VALUES(3,'NEHA','28600','81307','helpdesk'); INSERT INTO NAMES VALUES(4,'VISHAL','28600','96677','helpdesk'); INSERT INTO NAMES VALUES(5,'SONU','28600','96508','helpdesk'); /* Display all the records from the table */ SELECT * FROM NAMES; SELECT SUM (salary) AS "Total Salary" FROM NAMES WHERE salary > 20000; /* Create a table called NIC */ CREATE TABLE NIC(Id int, Name varchar(255), salary varchar(255), mobile varchar(255), designation varchar(255)); /* Create few records in this table */ INSERT INTO NIC VALUES(1,'VIKRANT','40000','12356','TESTER'); INSERT INTO NIC VALUES(2,'KARAN','45000','12353','TESTER'); INSERT INTO NIC VALUES(3,'RAJNISH','45000','12359','TESTER'); INSERT INTO NIC VALUES(4,'GOURAV','42000','12351','TESTER'); INSERT INTO NIC VALUES(5,'JEETESH','43000','12369','TESTER'); /* Display all the records from the table */ SELECT * FROM NIC; ALTER TABLE NIC ADD EMAIL varchar (255); /* Display all the records from the table */ SELECT * FROM NIC; UPDATE NIC SET EMAIL= 'VIKI' WHERE ID ='1' OR ID='3'; /* Display all the records from the table */ SELECT * FROM NIC; SELECT AVG(salary) AS "Total AVARAGE" FROM NAMES; SELECT COUNT(EMAIL) AS "EADD" FROM NIC WHERE EMAIL = 'VIKI';
run
|
edit
|
history
|
help
0
Branch
Transpose group per sequence
robot-grading
TRIGGERS
Ggg
View jobs
Varchar to Binary and vice-versa
parameters_in_procedure-join&correlated sub-query content
SqlServer1282018
Primary key and unique key for single column and multi columns