Basics of C# and its Installation

  17th Day

Hey Guys, I hope that you are Enjoying with my blogs and Today's we will study about .NET Platform with "C#" Language. Please read, share and Comments.




  .NET 

  • .NET is a free, cross-platform, open source developer platform for building many different types of applications.
  • .NET Core is a cross-platform .NET implementation for websites, servers, and console apps on Windows, Linux, and macOS.
  • With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, and IoT.
  • You can write .NET apps in C#, F#, or Visual Basic.
  • So we will  do study of C#.   

       History:

  • Microsoft family started development of .NET framework the late 1990s originally under the name of Next Generation Windows services.  
  • .NET frame work was released on 13 Feb 2002. The version was called .NET framework 1.0.

   C# :

  • its a programming language, general-purpose, multiprogramming language, encompassing static typing, Strong typing, lexically scoped etc.
  • It was developed around 2000 by Microsoft as part of its .NET.
  • It was designed by Anders Hejisberg.
  • The most recent version is 9.0, Which was released in 2020 in .NET 5.0 and included in Visual Studio 2019 version 16.8.
      Installation of .NET framework:
       Select Community version for downloading purpose.

Then after run the Visual studio we will have to select like:
  • After download just run this application and then create a new project

  • Select Console app(.NET Core) and ok......

so finally Project has been created .....lets run simply.....

You must watch this video for more details...


Thank You...



                               

ASP.NET MVC Interview Questions Part 1

 

   Hey Guys I hope that you are Enjoying with my Blogs Writing and in this blog we will cover Interview question of ASP.NET MVC Core. So Lets Start....

                                   

     Q. What is ASP.NET MVC ?
  • ASP.NET MVC is an open-source cross platform web development to develop web application which is created by Microsoft. Its web development framework combines the features of MVC (Model-View-Controller) architecture.
  • Make it easier to manage complexity by dividing an application into the model, the view, and the controller.
  • When we create a new project then it is created automatically.
       Q. Why do we need Appsettings.json ?
  • Appsettings.json file an application configuration file which is used to store configuration settings such as database connection strings, version no etc.
  • When we create an ASP.NET core web application with an empty project template or MVC templet or Web API Template, then the visual studio automatically creates the appsettings.json file for us as show in the below image.
  • Its is exist in JSON format.

      Q. What is JSON ?
  • JSON is stands for JavaScript object notation it is commonly used to transmitting data in the web application.
  • Its exist in JSON format like name and value.       
    Q. What kind of things go in to wwwroot ?
  • All statics file in our project go into this folder.
  • Statics files like HTML, CSS, and images file etc. stored inside this folder.
      
       

      Q. What does program.cs ?
  • Program.cs file is the entry point of the application. This will be executed first when the application run, There is a public static void main method.
  • Whatever Coe you write inside that method will be executed in that same order.  
      
    Q. What does ConfigureService and Configure method do in Startup.cs ?

                          



    Q. How is the flow of MVC ?
  • MVC is an Architecture pattern which is stands for Model, View and Controller. 
  • If any End users sends the request to the browsers then it first hits to the Controller.
  • And take the data from the model and data put it into the view.
  • And view send as HTML to the Browsers .
  • For Example , Given Below image.


    Q. What are Razor views ?
  • Razor view is a markup syntax which helps us to write code of HTML and Server side in Web page using C# or VB.NET
  • Razor view Engine is general purpose templating engine.
  • The Razor view Syntax starts with @{..  Code...    }.



                                                                Thank You...

SQL SERVER PART II

 Hey Guys, I hope that you are enjoying with my blogs writing and today's we will cover some  "SQL SERVER" Concepts.


Microsoft SQL Server is a relational database management system, or RDBMS, developed and marketed by Microsoft.
As a database server, it is a software products with primary function of storing and retrieving data as requested by other software application.
Initial Releases is April 24, 1989;

   SQL UNION OPERATOR:
  • The union operator is used to combine the result-set of two or more select statements.
  • Every select statements within union have the same number of columns
  • The columns also have similar data type
  • The columns in every select statement must also be in the same order
                         
  • Syntax: 
  • For Distinct Contents: 
        select column_name(s) from table1 union select column(s) from table1;
        For Example: 
                              Input:
    select Id, FirstName, LastName from tblCustomer1


union
select Id, FirstName, LastName from tblexpired



                                Output:


  • For All Contents:
        select column_name(s) from table1 union select column(s) from table1;

          For Example: Input
 select Id, FirstName, LastName from tblCustomer1
union all
select Id, FirstName, LastName from tblexpired
                                Output: Both table has mentioned above and we have taken UNION ALL.
                             Note: We can indicate content by using as normal and expired or anything like:

select 'nomal' as type1, Id, FirstName, LastName from tblCustomer1
union all
select 'expired' as type1,Id, FirstName, LastName from tblexpired

  • GROUP BY:
  •  This statement is often used with aggregate function(COUNT(),MAX(), MIN(),SUM,AVG()).
  • For Example: we have created a table "tblCustomer_ctry" by using this aggregate function we will find its sum of sales of two Countries.
  • "tblCustomer_ctry"    

        Input:  select count(Id), sum(sales),Country from tblCustomer_ctry
                  group by country
      Output:

SUBQUERY: A subquery is a query within another SQL query and embedded within WHERE clause.
  •  It is also called Nested Query.
  • In this case firstly executes its inside queries and after that outside queries.
  • Above two table has created tblCustomer and tblAddress .
            Input: select * from tblAddress
                      where CustomerId_fk in
                      (select Id from tblCustomer)

     Co-related queries : In this Queries ,first executes outside queries and send        the data for inside execution and again send the data from inside to outside. 
            Input: select * from tblAddress
                      where CustomerId_fk in
                      (select Id from tblCustomer where Id=CustomerId_fk)

                                             Thank You...


Hacker Rank Problem Solving on SQL

                                           # PROBLEM-1

Hey Guys , I hope that you are Enjoying with my Blogs writing and this the problem solution of "HACKER RANK SQL ".This solution will definitely will help you.

Problem Statement:  Revising the Select Query I

Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA .

The CITY table is described as follows:


Solution: 

  •  First of all read the problem statements carefully.
  • Write Query to show the all columns for all American cities which is already has in the table "CITY". 
  • And Countrycode is "USA"
  • With population larger than 100000.


             select * from CITY where CountryCode ='USA' AND Population > 100000


                                                    # PROBLEM-2

Problem Statement:  Revising the Select Query II

Thank You...






 

SQL SERVER PART I

 Hey Guys, I hope that you are enjoying with my blogs writing and today's we will cover some  "SQL SERVER" Concepts.


Microsoft SQL Server is a relational database management system, or RDBMS, developed and marketed by Microsoft.
As a database server, it is a software products with primary function of storing and retrieving data as requested by other software application.
Initial Releases is April 24, 1989;

    Q. Explain what is a Identity column ?
  • Identity Column means its increase the indexing automatically in SQL.
  • For Example: Below has given a table which Id has autoincrement.
    To Implement this Settings go to Column properties -> Indentity Specification->Double click on that->Double click on Is Identity 
  1. Q. Are Nulls allowed in Foreign Keys ?
  • Yes, it can be null or duplicate. foreign key containing null values cannot match the values of a parent key. However, a null foreign key value is always valid, regardless of the value of any of its non-null parts.
  • For Example
    Above has mentioned if we will give null value to foreign key then it will be ok.
     Q. How can we create composite key ?
  • In Database design, a composite key is a candidate key that consist of two or more attributes ( table columns) that together uniquely identify an entity occurrence(table row).
  •  For Example: I have created a table name" tblCustomer2".
  • In that we have taken more than two Primary key which is also known as Composite key.   
    We have taken Id and FirstName as a Primary key.
     Q. How to write a simple SQL with "Where" clause ?
  •  The Where  clause is used to filter records.
  • Its filter those records which fulfil conditions.
  • Syntax:  
          select Column1, Column2..,
          from table_name
          where condition;
  •  Example: select * from tblCustomer1
    This will show whole records of tblCustomer1. 


  • But in case of  Where Clause it gives particular record.

        Note: Its not only used in SELECT statement, its also used in UPDATE, DELETE etc. 
    Q. How to select Specific columns in select?
  •  To write Specific columns in select 
     " select column1,column2 from table name
        where Id;"    
             For Example:


        QWhat is an ALIASES in SQL ?
  • It is often used to make column names more readable.
  • It  is created with As Keyword.
  • Syntax: For Column  
       select column_name AS alias_name
       from table_name;

      For Row
        select column_name(s) 
       from table_name AS alias_name ;

       For Example:



Q. Explain the difference between inner vs left vs right ? 

  • INNER JOIN: INNER JOIN keywords just select records that have matching values in both tables like 
  •                                
  • Syntax: 
         select column_name(s)

from table1

inner join table2

on table1.column_name=

table.column_name;

  • For Example:
         select 
         cust.Id,
         cust.FirstName,
         cust.LastName,
 address.Address 
 from tblCustomer1 as cust 
         inner join tblAddress1 as address 
 on cust.Id=address.Customer_fk

                          

                • LEFT JOIN: LEFT JOIN keyword returns all records from the left table(table1), and the matching record table from right table.

                         Example:
                          select 
                         cust.Id,
                         cust.FirstName,
                         cust.LastName,
                 address.Address 
                 from tblCustomer1 as cust 
                         left join tblAddress1 as address 
                 on cust.Id=address.Customer_fk



                • RIGHT JOIN: RIGHT JOIN keyword returns all records from the right table(table2), and the matching record table from left table.
                       
                        Example 
                         select 
                         cust.Id,
                         cust.FirstName,
                         cust.LastName,
                 address.Address 
                 from tblCustomer1 as cust 
                         right join tblAddress1 as address 
                 on cust.Id=address.Customer_fk


                Thank You...













                SQL SERVER

                 Hey Guys, I hope that you are enjoying with my blogs writing and today's we will cover some  "SQL SERVER" Concepts.


                Microsoft SQL Server is a relational database management system, or RDBMS, developed and marketed by Microsoft.
                As a database server, it is a software products with primary function of storing and retrieving data as requested by other software application.
                Initial Releases is April 24, 1989;

                1. Click here to Download SQL Server
                2. Click here to Download SQL Server Management Studio . After download this application just connect to the required server like that

                3. To create the new Database:  Go to Right side Object Explorer->Right click on Database->new database->Give Database Name->ok and refresh. Now Database has been created name SGM2021.
                                              
                   To create the new table in SGM2021 Database: Go to table->Right click->new table ->Give data and data type-> cltr+s-> give the table name->ok and refresh.

                                   


                To check , The table has created or not go to New query write " select * from table_name " and execute like.

                Q. What is Primary Key in SQL Server ?.
                • A primary key is a field in a table which uniquely identifies each row/record in a database table. 
                • Primary keys must contain unique values. 
                • A primary key column cannot have NULL values.
                • Above has created table Select one or more column->Right click->Click on primary key and finally Primary key has applied as per requirement.
                • For Example we have taken "id" as a Primary key in below table.
                 Q. How can I create primary key and foreign key relationship ?
                • To create the relationship of Primary key and foreign key we have to create two different table first one has created above "tblcustomer" with Primary key. And next table has created "tbladdress". 


                To Create Relationship: Select Customerid_fk->Right click->Click on Relationship->Add->There will be two options to select data like:
                                   -> then Ok







                                                          Thank you...