Saraswat World
-
WHAT ARE THE NUMERIC TYPES IN PYTHON?
NUMERIC DATA TYPES Python uses following three types of numeric data types. type() function in Python is used to get data type of object. Data Type Examples Output Description int x=1 print(type(x)) <class ‘int’> Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length. float x = 3.5 print(type(x)) <class…
-
WHAT ARE THE DATA TYPES IN PYTHON?
Python has the following data types built-in by default. Variable can store data of different types as per requirements. Categories Data Type Example Text str x = “Be Happy” Numeric int x = 1 Numeric float x = 3.5 Numeric complex x = 1j Sequence list x = [“A”, “B”, “C”] Sequence tuple x =…
-
WHAT IS THE GLOBAL VARIABLE IN PYTHON?
Global Variables in python are the Variables that are created outside of a function. Global variables can be used anywhere by everyone within the program. To create a global variable inside a function, you can use the “global” keyword and its scope will be global. Example- x=”globalVariable1″ #variable declaration y=”globalVariable2″ #variable declaration def…
-
WHAT IS THE VARIABLE IN PYTHON?
Python variables are the reserved memory locations used to store values with in a Python Program. A variable in Python is created the moment you first assign a value to it. Variables in Python do not need to be declared with any particular type, and can even change type after they have been set. If…
-
HOW TO PRINT IN PYTHON?
•print function,which writes to standard out. Standard out is where the computer writes its output. •Strings or characters are enclosed in inverted commas. print(“hello world”) •Output of above statement. hello world •To print out multiple items, you can provide them separated by commas. You can put strings and numbers in a print function. print(“my”,”program no.”,1)…
-
WHAT IS THE PYTHON SYNTAX?
Python syntax defines a set of rules that are used to create Python statements while writing a Python Program. Case sensitivity in Python- Case sensitivity in Python is applicable as python is a case sensitive programming language. Indentation in Python- Indentation in Python is used to indicate a block of code, all statements within the…
-
HOW TO INSTALL PYTHON AND EXECUTE PROGRAM?
To check if you have python installed on a Windows PC, run the following command on the Command Line (cmd.exe)- python –version If you find that you do not have Python installed on your computer, then you can download it from website: https://www.python.org/ To execute the program first save the code in the text editor…
-
WHAT IS PYTHON?
Python is an interpreted programming language released in 1991. Python was created by Guido van Rossum, Dutch Programmer. Python is a high-level, interpreted, interactive, and object-oriented scripting language. Python source code is also available under the GNU General Public License (GPL). Python supports multiple programming paradigms, including Procedural, Object Oriented and Functional programming language. Python…
-
PYTHON FREE COURSE
Learn Python
-
WHAT IS SQL?
SQL, stands for structured query language, is a domain-specific declarative programming language based on tuple relational calculus and relational algebra. It is used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). RDBMS is a relational database management…
-
WHAT ARE THE SUB LANGUAGES OF SQL?
SQL consists of many types of statements which are classified in five types of sub-languages- Data Definition Language (DDL): to create and modify the structure of the database. All the commands of DDL are auto-committed which means it permanently saves all the changes in the database.DDL Commands: Data Manipulation Language (DML): DML commands are used…
-
HOW TO CREATE A DATABASE IN SQL?
To create a database in SQL the CREATE DATABASE statement is used. The database name should be unique and less than 128 characters. To create a database in SQL and SQL Server use the command- CREATE DATABASE database_name; Example- CREATE DATABASE student_db; To view database in SQL use command- SHOW DATABASE; To Create or Replace…
-
HOW TO DELETE A DATABASE IN SQL?
DROP DATABASE To drop an existing SQL database use command- DROP DATABASE database_name; HOW TO DROP DATABASE IN T-SQL DROP DATABASE [IF EXISTS] database_name(s); Example- DROP DATABASE [ IF EXISTS] database_name1 , database_name2, database_nameN; Note- We are required to keep a database backup if we need to recover it in the future. We are…
-
HOW TO CREATE TABLE IN SQL?
CREATE TABLE CREATE TABLE statement is used to create a new table in the database. A table definition consists of the table name, a list of columns, their data types, default values, and any integrity constraints as shown in below SQL server syntax – CREATE TABLE <table_name1> ( <column_name1> <data_type> <default_value> <identity_specification> <column_constraint>, <column_name2> <data_type>…
-
HOW TO DROP, TRUNCATE AND DELETE TABLE?
DROP TABLE, TRUNCATE TABLE AND DELETE IN SQL Key Word Syntax Explanation DROP TABLE DROP TABLE <table_name>; DROP TABLE is used to delete a table definition and all data from a table TRUNCATE TABLE TRUNCATE TABLE <table_name>; TRUNCATE TABELE is used to remove all rows or complete data from a table. It doesn’t delete the…
-
HOW TO ALTER TABLE IN SQL?
ALTER TABLE IN SQL ALTER TABLE statement is used to add, delete, or modify columns and add or drop constraints on existing table. ALTER TABLE- ADD COLUMN Syntax- ALTER TABLE <table_name> ADD <column_name> <datatype>; Example- Following SQL will add DOB column to existing msstudentsnew table- ALTER TABLE msstudentsnew ADD DOB date; ALTER TABLE – ALTER…
-
HOW TO DATA INSERT INTO TABLE IN SQL?
INSERT INTO INSERT INTO statement is used to insert values or records into table in SQL. Records in a table can be added by specifying both the column names and their values that need to be updated. Syntax- INSERT INTO <table_name>(column1, column2, column3, …) VALUES (value1, value2, value3, …); Records in a table can also…
-
HOW TO UPDATE EXISTING RECORDS IN TABLE IN SQL?
UPDATE UPDATE statement is used to update the existing records in a table in SQL. Syntax- UPDATE <table_name> SET column1 = value1, column2 = value2, … WHERE <condition>; Example- UPDATE mstudentsnew SET st_name = ‘Ajai’ WHERE st_id = 1; Note- IF WHERE Clause is not used it will update all the records.
-
HOW TO USE SELECT IN SQL?
SELECT SELECT statement is used to access records from a database. The table which stores the record returned by the SELECT statement is called a result-set table. Syntax- SELECT column_name1, column_name2, …column_nameN FROM <table_name>; Description- The column_name1, column_name2, …column_nameN are the name of those columns in the table whose data we want to read or access. Syntax-…
-
HOW TO SELECT DISTINCT VALUES IN SQL?
SELECT DISTINCT The SQL DISTINCT command is used with SELECT key word to retrieve only distinct or unique values. Syntax- SELECT DISTINCT column_name1, column_name2, …column_nameN FROM <table_name>; Description- The distinct values from column_name1, column_name2, …column_nameN will be retrieved. It will avoid duplicate data.