1.
Define all kinds of literals and give examples as well based on video Part 1
Numeric Literal – it is used to assign numbers or store it into a character string.
Example: Weight = 80
String/Character Literal – used to assign characters (words) into a character string.
Example: Color = ‘Blue’
Array Literal – Much like String literal where characters are assigned to a character
string, the difference however is that it is used to set values inside a specific pointer; used with “[
]”; Always starts at 0.
Example: Color[0] = ‘Blue’
Color[1] = ‘Green’
Color[2] = ‘Yellow’
Class Literal (noun) / Method Literal (verb) – I dunno
Example: Class Literal:
Park()
Name()
Method Literal:
toWalk()
toExercise()
2. Define all the steps on how to Login to SQL Server based on video Part 2 (add screenshot)
Search Microsoft SQL Server Management Studio and run as administrator
In server type select Database Engine, in Server name just input period (.), and in
authentication you can select either Windows Authentication or SQL Server
Authentication. Select connect afterwards.
You are now Logged In
3. Create a Simple Database on video Part 5
4. Define all the datatypes available on SQL Server and give 1 example each based on Part 9
Data types
Exact Numeric – used to store numbers.
Sample Query:
DECLARE @Datatype_Int INT = 2
PRINT @Datatype_Int
Output is “2”
Approximate Numeric – to store floating-point and real values.
Sample Query:
DECLARE @Datatype_Float FLOAT(24) = 22.1234
PRINT @Datatype_Float
Output is “22.1234”
Data and time – stores data of type Date and time
Sample Query:
DECLARE @Datatype_Date DATE = '2030-01-01'
PRINT @Datatype_Date
Output is “2030-01-01”
Character Strings – allows the user to define the data type of character which can be of
fixed and variable length
Sample Query:
DECLARE @Datatype_Char VARCHAR(30) = 'This is Character Datatype'
PRINT @Datatype_Char
Output is “This is Character Datatype”
Unicode Character Strings – stores the full range of Unicode character which uses the
UTF-16-character encoding
Sample Query:
DECLARE @Datatype_nChar VARCHAR(30) = 'This is nCharacter Datatype'
PRINT @Datatype_nChar
Output is “This is nCharacter Datatype”
Binary Strings – contains a binary string of fixed and variable length
Examples are image files, word files, text files.
Other Data Types – other different SQL server datatypes. For example, Hierarchyid, this
datatype represents a position in the hierarchy. A built-in data type designed to represent
trees, which are the most common type of hierarchical data. Each item in a tree is called a
node. In a table format, it is a row with a column of hierarchyID data type
For example, if you have a hierarchyID column named RankNode, you can have the
following syntax:
RankNode.<methodname>
5. Inside the Database you created, please create a table having 5 columns then add 5 records on
the table.