Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SQL5
--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 int, Name varchar(255), salary varchar(255), mobile varchar(255), designation varchar(255)); /* 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; /* Create a table called NIC */ CREATE TABLE NIC(Id int, Name varchar(255), salary varchar(255), mobile varchar(255), designation varchar(255),age varchar(255)); /* Create few records in this table */ INSERT INTO NIC VALUES(1,'VIKRANT','40000','12356','TESTER','32'); INSERT INTO NIC VALUES(2,'KARAN','45000','12353','TESTER','35'); INSERT INTO NIC VALUES(3,'RAJNISH','45000','12359','TESTER','33'); INSERT INTO NIC VALUES(4,'GOURAV','42000','12351','TESTER','32'); INSERT INTO NIC VALUES(5,'JEETESH','43000','12369','TESTER','37'); INSERT INTO NIC(Id,Name,salary,mobile,designation,age) VALUES (6,'RUDRA','55000','24598','DEVELOPER','19'); /* 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 COUNT(EMAIL) AS "EADD" FROM NIC WHERE EMAIL = 'VIKI'; SELECT TOP 2* FROM NAMES; SELECT MIN(salary) AS LOWESTSALARY FROM NIC; SELECT MAX(salary) AS MAXSALARY FROM NAMES; /* Create a table called INFORMATICS */ CREATE TABLE INFORMATICS( Id int, Name varchar(255),contact varchar(255),blood_group varchar(255), join_date varchar(255)); /* Create few records in this table */ INSERT INTO INFORMATICS VALUES (1,'SONU','35467','O+','8_JUNE'); INSERT INTO INFORMATICS VALUES (2,'VISHAL','794873','A+','8_JUNE'); INSERT INTO INFORMATICS VALUES (3,'NEHA','8342','B+','8_JUNE'); INSERT INTO INFORMATICS VALUES (4,'MUKESH','22634','A-','8_JUNE'); INSERT INTO INFORMATICS VALUES (5,'BHARTI','2823749','AB+','8_JUNE'); /* Display all the records from the table */ SELECT * FROM INFORMATICS; SELECT NAMES.Name, INFORMATICS.blood_group, NAMES.salary,INFORMATICS.join_date, NAMES.designation, NAMES.mobile, INFORMATICS.contact FROM NAMES INNER JOIN INFORMATICS ON NAMES.Name=INFORMATICS.Name; SELECT Name,salary,designation,age FROM NIC WHERE EMAIL IS NOT NULL;
run
|
edit
|
history
|
help
0
Foreign keys
28-02
Empresa
Output
omnichannel_example
sql-server-storing-wildcards-in-data
MLK Date
1
Insert With Output Cluase
Names