MS SQL


MS SQL

GOTO THIS WEB LINK FOR ONLINE SQL PRACTICE

https://sqliteonline.com/



https://sqliteonline.com/


CONNECT MS SQL

CLICK TO CONNECT 


CLICK "OK"


FINALLY PROJEC READY

FINALLY PROJEC READY


------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------

Example Table-1

Country Phone Numbers

S.No Country Name Country Code Mobile Number
1 India +91 +91 98765 43210
2 United States +1 +1 555 123 4567
3 United Kingdom +44 +44 7700 900123
4 Australia +61 +61 412 345 678
5 Canada +1 +1 604 555 1234

----------------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------

Example Code:
-----------------------


-- Drop the existing table if it exists
DROP TABLE IF EXISTS country_phone_numbers;

-- Create the table
CREATE TABLE country_phone_numbers (
    id INTEGER PRIMARY KEY,  -- Define id as INTEGER
    country_name TEXT NOT NULL,
    country_code TEXT,       -- TEXT to accommodate '+' sign
    mobile_number TEXT       -- TEXT for mobile numbers
);

-- Insert data into the table with explicit IDs
INSERT INTO country_phone_numbers (id, country_name, country_code, mobile_number) VALUES (1, 'India', '+91', '9876543210'); 
INSERT INTO country_phone_numbers (id, country_name, country_code, mobile_number) VALUES (2, 'United States', '+1', '5551234567');
INSERT INTO country_phone_numbers (id, country_name, country_code, mobile_number) VALUES (3, 'United Kingdom', '+44', '7700900123');
INSERT INTO country_phone_numbers (id, country_name, country_code, mobile_number) VALUES (4, 'Australia', '+61', '412345678');
INSERT INTO country_phone_numbers (id, country_name, country_code, mobile_number) VALUES (5, 'Canada', '+1', '6045551234');

-- Select all data from the table
SELECT * FROM country_phone_numbers;

-- Select only country names from the table
SELECT country_name FROM country_phone_numbers;

------------------------------------------------------------------------------------------------------------------------

To print full Table 

1









full table print output:



To Printing Vertically lines only

Ex. Code:
-------------
-- Select all data from the table
   SELECT * FROM country_phone_numbers;

-- Printing Vertically lines

 --Select only country names from the table
-- SELECT id FROM country_phone_numbers;
 
 -- Select only country names from the table
-- SELECT country_name FROM country_phone_numbers;
 
 -- Select only country names from the table
-- SELECT country_code FROM country_phone_numbers;
 
 -- Select only country names from the table
-- SELECT country_code FROM country_phone_numbers;
 

-------------





To Print id 

To Print country_name

To Print country_code

To Print mobile_number

















------------------------------------------------------------------------------------------------------------------------
To Printing Horizatally Lines only


Ex. Code:
-------------
 -- Printing Horizatally Lines
 
 SELECT * FROM country_phone_numbers WHERE id = 1;

-- SELECT * FROM country_phone_numbers WHERE id = 2;

-- SELECT * FROM country_phone_numbers WHERE id = 3;

-- SELECT * FROM country_phone_numbers WHERE id = 4;

-- SELECT * FROM country_phone_numbers WHERE id = 5;
------------------------------------------------------------------------------------------------------------------------

print only haryzatally lines i need print only id 1

To retrieve only the row with id = 1 from your country_phone_numbers table, you can use a SELECT statement with a WHERE clause. This will filter the results to show only the entry you want.

Here’s the SQL query to achieve that:



id = 1


id = 2

id = 3



id = 4


id = 5


Execution

  1. Execute the provided SQL query in your SQLite environment.
  2. It will return the details for the country with id = 1, which in this case is India.

If you need to format the output or if you have additional questions, let me know!



link for  above programe 

https://sqliteonline.com/




https://sqliteonline.com/









Ex. Code:
-------------


-------------




Comments

Popular posts from this blog

how to practice javascripts online

ui/ux road map

Adobe Photoshop 2024 v25.12.0 Cracked for macOS