Posts

Showing posts from October, 2011

LinkList

// linklist.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; //Make a class named node whose instances will be used in LinkList //class class node {       friend class linklist; private :       int val;       node *next; public :             //Sets value of variable val to the argument passed.       void setvalue( int x)       {             val=x;       }             //Returns value of variable val       int getvalue()       {             return val;       }             //Sets the node type object to the argument passed       void setnext(node *a)       {             next=a;       } //Returns the address of next because "next" is a node type //pointer.       node * getnext()       {             return next;       }       }; class linklist { private :       int size;          //Total nodes in linklist       node* head;        //head has address of first node of linkli

SQL Single Row Functions

Single Row Fuctions : Single row functions are also called aggregate functions. Single row functions return only one row when they are executed. Sample Table Doctor_id   Name       Fee D101 John 10000 D102 Peter 20000 D103 Nash 30000 D104 Andrew 25000 D105 Smith 15000 1 select sum ( fee ) as fee_total from doctor Sum function will return the total fee from all rows fee_total 100000 2 Min function returns the smallest value from all rows for the column specified select min ( fee ) as minimum_fee from doctor      minimum_fee 10000      3 Max function returns the maximum value from all rows for the column specified select max ( fee ) as maximum_fee from doctor maximum_fee 30000 4 Count function returns the total number of rows in the table select count ( doctor_id ) as total_doctors from doctor      total_doctors   5      5 Avg() function return the average from row specified.Avg() functions --is applied on numeric values select