Posts

SQL Server System databases

Image
  Types of system databases Introduction Each time you install any SQL Server instance on a server, by default/automatically 4 primary system databases are created. m aster model msdb tempdb     Master database It is a critical database, because SQL Server uses this database to store all the information about SQL Server instance, like ·         File location of the user database -> If you create any user database all the information and configuration details ·         Login accounts ·         Server configuration setting ·         Link Servers information ·         Start-up stored procedures If for any reason, master database is not accessible or doesn’t exist or can not be read then the SQL Server instance can not start. It’s important to backup the master database w...

Python Statements

Indentation: Indentation is very import while using python statements. It is important to keep a good understanding of how indentation works in Python to keep you code structure and in proper order to execute the code. Example : Simple print statement with if condition: if True:    print('This is a True statement') This is a True statement Try printing with Logic: if, else Statements Syntax: if case:     perform action1 else:     perform action2 Example: name='Feroz' if name == 'Feroz':     print('Hello Feroz!') else:     print('Welcome to the Group!') Hello Feroz! if, elif, else Statements Syntax: if case1:     perform action1 if case2:     perform action2 else:     perform action3 Example: sports='cricket' if sports == 'cricket':    print('Welcome to Cricket Club!') elif sports == 'Foot Ball':   print('Sorry! it is currently not available') else:    print('This game not present in ...

Comparison Operators in Python

Comparison Operators: Equals                                    ==   Dees not equal                     != Less than                              < Greater than                          > Less than or equals           <= Greater than or equals      >= Examples: 1==1 True 1!=1 False 1<2 True 1>2 False 1<=1 True 1>=1 True Logical Operators to combine the comparisons: and : Both condition should be true to TRUE or  not : Either of the condition to be true to TRUE Examples: 1==1 and 2==2 True 1==2 and 2==2 False 1==1 or 2==2 True 1==2 or 2==2 True

Files in Python

 Files? Python uses file objects to interact with external files which are available on you location computer and the files can be any sort of file like, Text file, audio file, excel file, and even Emails. Creating a File: If you are using Windows create a text file based on the location (if you are using command line method). However, if you are using Jupyter notebook you could use below command to create a text file. %%writefile firstfile.txt  This is my first text file to run the python commands. I will execute this file to test the result. It is the end of the text file. Open a File: >>> mytextfile=open('first_file.txt') Note: If your file is not at a default location so you will get the below error (if file doesn't exists)  >>> mytextfile=open('first_file1.txt') Traceback (most recent call last):   File "<stdin>", line 1, in <module> FileNotFoundError: [Errno 2] No such file or directory: 'first_file1.txt' The abo...

Boolean in Python

What is a Boolean? Ture or False (Make sure to use initial letter as a capital) For Example, >>> True True >>> true Traceback (most recent call last):   File "<stdin>", line 1, in <module> NameError: name 'true' is not defined Examples: >>> x= True >>> type(x) <class 'bool'> >>> 9 > 8 True >>> 8> 9 False  How to define/assign a variable without value? >>> x Traceback (most recent call last):   File "<stdin>", line 1, in <module> NameError: name 'x' is not defined Here is the way, you could define the variable without defining/assigning the value >>> x=None >>> x

Sets in Python

 What is Sets? Sets are an unordered collection of unique elements and created by using set() function.  -- Creating a Set my_set=set() -- Adding an element to set using add() method >>> myset=set() >>> myset.add(5) >>> myset {5} --- Lets try to add additional values to set >>> myset.add(6) >>> myset.add(7) >>> myset {5, 6, 7} --- Lets try to add duplicate values into the set  >>> myset {5, 6, 7} >>> myset.add(7)   - ----------- adding the same item "7" which is already present in the Set >>> myset {5, 6, 7}        -------------------- It did not add the items "7" twice but it just maintain  uniqueness   --- Let try to get the unique values from the set >>> myset=[9,9,9,8,8,8,7,7,7] >>> set(myset) {8, 9, 7} >>> set('Administration') {'a', 'd', 'A', 'r', 's', 'o', 'm', 't', 'n', ...

Tuples in Python

 Tuples Basically Tuples in Python are very similar to Lists, but, Tuples are immutable which means that they can not be modified/changed. We generally use Tuples to make sure the values are not changed like, dates, Year, and days of the week or dates on a Calendar.  Creating a Tuple: >>> my_t1=(1,2,3) >>> my_t2=('one','two','three') >>> my_t1 (1, 2, 3) >>> my_t2 ('one', 'two', 'three') -- check the length of tupple: >>> len(my_t1) 3 >>> len(my_t2) 3 -- Tuples can have mixed objects as like Lists. >>> my_t3=(1,'two',3,'four') >>> my_t3 (1, 'two', 3, 'four') -- indexing with tuples  >>> my_t3=(1,'two',3,'four') >>> my_t3[2] 3 Immutable Tuples We can not modify the value. Here is the example: >>> my_t3=(1,'two',3,'four') >>> my_t3[2]=4 Traceback (most recent call last):  ...