Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • All About Trace Fils Oracle
  • Read CSV File using Python Python/PySpark
  • checking redhat linux version Linux/Unix
  • Deleting first line and lastline of a file using sed Linux/Unix
  • Configure ssh authentications for RAC Oracle
  • DBMS_JOB all example Oracle
  • create PLAN_TABLE command. Oracle
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • plan10g.sql Oracle
  • Oracle Standby Database Library Index from Metalink Oracle
  • CPU Core related projections AWS
  • OPENING A STANDBY DATABASE IN READ-ONLY MODE Oracle
  • move_arch_files.ksh /* Good One */ Linux/Unix
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • handling filenname with space Linux/Unix

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook
# Databricks notebook source

 

%sql
create database if not exists abcdb

 

%sql
use abcdb

 

%sql
create table student (id int , name string)

 

%sql
insert into student
select 1 as id, ‘user1’ as name

 

%sql
select * from student

 

spark.sql(“create database if not exists xyzdb”)
spark.sql(“use xyzdb”)

 

# Use three double quotes (“””) if SQL you are using has multiple lines.
spark.sql(“”” create table student1
        ( id int,
        name string )”””)

 

spark.sql(“”” insert into student1
        select 2 as id, ‘test1’ as name””” )

 

# Different format of printing or displaying dataframe.

# Selecting rows from dataframe
spark.sql(“select * from student1”).display()
spark.sql(“select * from student1”).show()

# Storing result-set in collection
spark.sql(“select * from student1”).collect

# Describe schema and datatype
spark.sql(“select * from student1”).printSchema()

 
Python/PySpark

Post navigation

Previous Post: Read CSV file using PySpark
Next Post: Add new columns in dataframe

Related Posts

  • Add new columns in dataframe Python/PySpark
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Read CSV file using PySpark Python/PySpark
  • Python class import from different folders Python/PySpark
  • Reading config file from other folder inside class Python/PySpark
  • Read CSV File using Python Python/PySpark

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (388)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (337)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • crtgr.sql /* For creating trigger from data dictionary */ Oracle
  • Single character replacement in Unix Linux/Unix
  • Oracle GoldenGate lag monitoring shell script Linux/Unix
  • oracle 10g on linux Linux/Unix
  • Export Oracle data and Compress at same time Oracle
  • oradebug ipcrm ipcs Oracle
  • checking redhat linux version Linux/Unix
  • default permission on ~/.ssh/authorized_keys2 or authorized_keys Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme