Skip to content

Instantly share code, notes, and snippets.

View charanhu's full-sized avatar

Charan H U charanhu

View GitHub Profile
CREATE TABLE CONSTRAINT_DEMO2
(
ID INT,
NAME VARCHAR(25) NOT NULL,
AGE INT,
ADDRESS VARCHAR(25) DEFAULT 'BANGALORE',
CONSTRAINT PK_ID2 PRIMARY KEY(ID), --TABLE LEVEL
CONSTRAINT CK_AGE CHECK(AGE>18)
);
--PRIMARY KEY
CREATE TABLE DEPT
(
DNO INT PRIMARY KEY,
DNAME VARCHAR(25)
)
--INSERT (DEPT TABLE)
INSERT INTO DEPT VALUES(1, 'HR');
INSERT INTO DEPT VALUES(2, 'DOTNET');
INSERT INTO DEPT VALUES(3, 'JAVA');
--CREATE DATABASE
create database DLithe
use DLithe
create table trainees
(
ID int NOT NULL,
Name varchar(25) NOT NULL
);
--INSERT RECORDS INTO THE TABLE
insert into trainees values(1, 'Charan');
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeeInfo
{
class PartialClass2
{
using System;
namespace EmployeeInfo
{
class PartialClass1
{
}
public partial class EmployeeDetails
{
private int empID;
using System;
namespace CalculatorApplication {
class NullablesAtShow {
static void Main(string[] args) {
int? num1 = null;
int? num2 = 45;
double? num3 = new double?();
double? num4 = 3.14157;
using System;
using System.IO;
namespace FileIOApplication
{
class Program
{
static void Main(string[] args)
{
FileStream F = new FileStream("test.txt", FileMode.OpenOrCreate,
using System;
using System.Collections.Generic;
namespace GenericApplication
{
public class MyGenericArray<T>
{
private T[] array;
public MyGenericArray(int size)
using System;
namespace PolymorphismApplication
{
class Shape
{
protected int width, height;
public Shape(int a = 0, int b = 0)
{
using System;
namespace DLithe
{
public class A
{
public string Name;
public void GetName() // ()
{
Console.WriteLine("Name: {0}", Name);