#PHP interview questions and answers for fresher
Explore tagged Tumblr posts
Text
BEST WORDPRESS INTERVIEW QUESTIONS AND ANSWERS
What Are WordPress Interview Questions?
WordPress interview questions assess a candidate's knowledge and skills related to the WordPress platform. These questions can range from basic concepts to advanced technical inquiries, depending on the candidate's experience level. Understanding the nuances of these questions can significantly enhance your chances of impressing potential employers.
What Interviewers Expect from WordPress Interview Questions
When conducting interviews, employers look for candidates who not only have technical skills but also possess a strong understanding of WordPress's functionality, security, and performance optimization. Here are key attributes interviewers expect from candidates:
Technical Proficiency: Candidates should demonstrate a solid grasp of WordPress features, including themes, plugins, and the Gutenberg editor.
Problem-Solving Skills: Interviewers seek individuals who can troubleshoot issues effectively and offer solutions.
Industry Knowledge: Understanding the latest trends and updates in the WordPress ecosystem is crucial.
Communication Skills: The ability to explain technical concepts in a clear manner is highly valued.
Passion for WordPress: A genuine interest in the platform and continuous learning are traits that set candidates apart.
Tips for Candidates to Prepare for WordPress Interview Questions
Preparation is key to excelling in a WordPress interview. Here are actionable tips to help you get ready:
Understand Core Concepts: Familiarize yourself with the basics of WordPress, including installation, themes, and plugins.
Explore Documentation: The official WordPress documentation is a goldmine for learning about features and best practices.
Practice Coding: If applying for a developer role, hone your PHP, HTML, and CSS skills. Work on projects to build a portfolio.
Stay Updated: Keep an eye on WordPress updates, new plugins, and trends within the community.
Engage with the Community: Participate in forums, attend meetups, and connect with other WordPress enthusiasts.
Mock Interviews: Practice with peers or use online platforms to simulate real interview scenarios.
Prepare Real-World Examples: Be ready to share your experiences and how you've solved problems in previous projects.
Review Common Questions: Familiarize yourself with frequently asked interview questions.
Build a Personal Site: Create a WordPress site to showcase your skills and serve as a practical reference during interviews.
Ask Questions: Prepare thoughtful questions to ask your interviewers, demonstrating your interest and engagement.
WORDPRESS Interview Questions for Freshers
Freshers often face entry-level questions to gauge their foundational knowledge. Here are 10 common questions, along with what interviewers expect and sample answers:
What is WordPress?
Expectation: Basic understanding of WordPress.
Sample Answer: “WordPress is a content management system (CMS) that allows users to create and manage websites easily, with a vast range of themes and plugins.”
How do you install WordPress?
Expectation: Familiarity with installation processes.
Sample Answer: “You can install WordPress by downloading the package from WordPress.org, uploading it to your web server, and following the setup wizard to configure the database and admin settings.”
What is a WordPress theme?
Expectation: Knowledge of customization options.
Sample Answer: “A WordPress theme dictates the design and layout of a site, allowing users to customize their site's appearance without altering the core functionality.”
Can you explain plugins in WordPress?
Expectation: Understanding of functionality enhancement.
Sample Answer: “Plugins are add-ons that extend the capabilities of WordPress, enabling features like SEO optimization, social media integration, and e-commerce functionalities.”
What is the difference between posts and pages?
Expectation: Clear distinction between content types.
Sample Answer: “Posts are time-stamped entries that appear in reverse chronological order, often used for blogs, while pages are static and typically contain content like ‘About’ or ‘Contact’ information.”
How do you create a menu in WordPress?
Expectation: Familiarity with the dashboard interface.
Sample Answer: “You can create a menu by going to Appearance > Menus in the WordPress dashboard, where you can add pages, posts, and custom links.”
What is the Gutenberg editor?
Expectation: Awareness of recent updates.
Sample Answer: “The Gutenberg editor is a block-based editor introduced in WordPress 5.0, allowing users to create content using blocks for text, images, and multimedia.”
What are categories and tags in WordPress?
Expectation: Understanding of content organization.
Sample Answer: “Categories are broad groupings for posts, while tags are specific keywords that help describe the content more precisely, aiding in site navigation.”
How do you secure a WordPress site?
Expectation: Basic security knowledge.
Sample Answer: “Securing a WordPress site involves regularly updating the core software, using strong passwords, installing security plugins, and implementing SSL certificates.”
What is a child theme?
Expectation: Awareness of theme customization.
Sample Answer: “A child theme is a separate theme that inherits the functionality and styling of a parent theme, allowing users to customize without affecting the parent theme's updates.”
WORDPRESS Interview Questions for Intermediate Level
For candidates with some experience, interviewers expect a deeper understanding of WordPress. Here are 10 intermediate-level questions with expectations and sample answers:
Explain the WordPress loop.
Expectation: Understanding of how WordPress retrieves posts.
Sample Answer: “The WordPress loop is a PHP code structure that WordPress uses to fetch and display posts from the database, allowing developers to customize how content is presented.”
How can you optimize a WordPress site for speed?
Expectation: Knowledge of performance optimization techniques.
Sample Answer: “To optimize a site for speed, I would use caching plugins, optimize images, minimize HTTP requests, and leverage Content Delivery Networks (CDNs).”
What is WP_Query?
Expectation: Familiarity with custom queries.
Sample Answer: “WP_Query is a class in WordPress used to create custom queries to retrieve posts based on specific criteria like category, tag, or custom fields.”
Describe the WordPress security best practices.
Expectation: Knowledge of maintaining site security.
Sample Answer: “Best practices include regular updates, using security plugins like Wordfence, restricting access to wp-admin, and using two-factor authentication.”
How do you create custom post types?
Expectation: Understanding of extending WordPress functionality.
Sample Answer: “Custom post types can be created by adding code to the functions.php file or using a plugin, allowing you to tailor content types like portfolios or testimonials.”
What are shortcodes, and how are they used?
Expectation: Familiarity with content embedding.
Sample Answer: “Shortcodes are special tags that allow users to embed files or create objects in WordPress posts and pages without writing full code. For example, [gallery] can display a gallery of images.”
Explain the concept of hooks in WordPress.
Expectation: Understanding of action and filter hooks.
Sample Answer: “Hooks allow developers to modify or add functionality to WordPress. Action hooks trigger functions at specific points, while filter hooks modify data before it is displayed.”
How do you manage WordPress updates?
Expectation: Knowledge of maintaining a site.
Sample Answer: “I manage updates by regularly checking for new versions of WordPress, themes, and plugins, and I back up the site before applying any updates to ensure a smooth process.”
What is the purpose of the .htaccess file?
Expectation: Understanding of server configuration.
Sample Answer: “The .htaccess file is used to configure rules for the Apache web server, controlling aspects like URL rewriting, security settings, and caching.”
How do you troubleshoot common WordPress errors?
Expectation: Problem-solving skills.
Sample Answer: “I start by checking error logs, disabling plugins to identify conflicts, and ensuring that the theme is compatible with the latest WordPress version.”
Interview Questions for Advanced Level
Advanced candidates should be prepared for in-depth technical questions. Here are 10 advanced-level questions, expectations, and sample answers:
What are REST APIs in WordPress?
Expectation: Understanding of data exchange mechanisms.
Sample Answer: “REST APIs in WordPress allow external applications to interact with WordPress data, enabling functionalities like creating, reading, updating, and deleting posts via external requests.”
Explain the concept of Multisite in WordPress.
Expectation: Knowledge of managing multiple sites.
Sample Answer: “WordPress Multisite is a feature that allows users to create and manage multiple WordPress sites from a single installation, sharing themes and plugins across all sites.”
**How do you optimize a Word
Press database?
Expectation: Understanding of database management.
Sample Answer: “To optimize a WordPress database, I would regularly clean up post revisions, spam comments, and transient options. Using plugins like WP-Optimize or running SQL queries to remove unnecessary data can help enhance performance.”
What is a WordPress cron job, and how does it work?
Expectation: Familiarity with scheduled tasks.
Sample Answer: “A WordPress cron job is a way to schedule tasks that run at specific intervals, like checking for updates or publishing scheduled posts. It works by checking the site’s traffic and running tasks based on predefined schedules.”
Describe how to implement custom user roles and capabilities in WordPress.
Expectation: Knowledge of user management.
Sample Answer: “Custom user roles can be implemented using the add_role() function in WordPress, allowing you to define specific capabilities for different user types tailored to site needs.”
How do you perform a website migration in WordPress?
Expectation: Understanding of the migration process.
Sample Answer: “To migrate a WordPress site, I would back up the files and database, move them to the new server, update the wp-config.php file with the new database details, and then run a search-and-replace to update URLs in the database.”
What strategies do you use to ensure high availability and scalability for a WordPress site?
Expectation: Knowledge of performance scaling.
Sample Answer: “To ensure high availability and scalability, I would utilize a content delivery network (CDN), implement load balancing across multiple servers, and leverage cloud hosting solutions like AWS to handle traffic spikes effectively.”
What techniques do you use to secure a WordPress site against DDoS attacks?
Expectation: Awareness of security measures.
Sample Answer: “To secure against DDoS attacks, I would employ a Web Application Firewall (WAF), rate limiting, IP blacklisting, and consider using services like Cloudflare that offer DDoS protection.”
Explain how to create a custom Gutenberg block.
Expectation: Familiarity with modern WordPress development.
Sample Answer: “Creating a custom Gutenberg block involves registering the block with registerBlockType(), defining its attributes and edit/view functions, and enqueuing the necessary JavaScript and CSS files in the theme or plugin.”
What are some common performance bottlenecks in WordPress, and how would you address them?
Expectation: Ability to diagnose and resolve issues.
Sample Answer: “Common performance bottlenecks include unoptimized images, excessive plugin usage, and server limitations. I would address these by compressing images, deactivating unnecessary plugins, and choosing a high-performance hosting provider.”
FAQs About WordPress Interview Questions
1. What should I study for a WordPress interview?
Focus on core WordPress concepts, theme and plugin development, security best practices, and optimization techniques.
2. How can I practice for WordPress interviews?
Engage in mock interviews, participate in online forums, and work on personal projects to apply your knowledge.
3. Are there resources for learning WordPress?
Yes, consider resources like the official WordPress documentation, online courses (e.g., Udemy, Coursera), and community forums like Stack Overflow.
4. What is the typical salary for a WordPress developer?
Salaries vary widely based on location and experience but generally range from $50,000 to $100,000 annually.
5. How important are soft skills for WordPress roles?
Very important! Communication, teamwork, and problem-solving skills are crucial for successful collaboration and project management.
0 notes
Text
🚀💼 Nailing Your Next PHP Job Interview! 💼🚀
Are you prepping for a PHP job interview? Don’t sweat it! We've compiled the Top PHP Questions and Their Answers to help you shine and secure that dream job! 🌟
🔍 Discover:
- Key PHP concepts every interviewer asks about
- Expert tips on how to answer confidently
- Insights to stand out from the competition
- Dive into our blog now and elevate your interview game! 🎯👇
0 notes
Text
0 notes
Text

Want to crack Interview for PHP? Here we have given PHP Interview Questions and Answers for Fresher which will give the proper knowledge about what type of questions will be asked in the interview and it will help you to crack the Interview easily.
PHP interview questions and answers for fresher
0 notes
Text
Best way to prepare for PHP interview
PHP is one among the programming languages that are developed with built-in web development functions. The new language capabilities contained in PHP 7 ensure it is simpler for developers to extensively increase the performance of their web application without the use of additional resources. interview questions and answers topics for PHP They can move to the latest version of the commonly used server-side scripting language to make improvements to webpage loading without spending extra time and effort. But, the Web app developers still really should be able to read and reuse PHP code quickly to maintain and update web apps in the future.
Helpful tips to write PHP code clean, reliable and even reusable
Take advantage of Native Functions. When ever writing PHP code, programmers may easily achieve the same goal utilizing both native or custom functions. However, programmers should make use of the built-in PHP functions to perform a number of different tasks without writing extra code or custom functions. The native functions should also help developers to clean as well as read the application code. By reference to the PHP user manual, it is possible to collect information about the native functions and their use.
Compare similar functions. To keep the PHP code readable and clean, programmers can utilize native functions. However they should understand that the speed at which every PHP function is executed differs. Some PHP functions also consume additional resources. Developers must therefore compare similar PHP functions and select the one which does not negatively affect the performance of the web application and consume additional resources. As an example, the length of a string must be determined using isset) (instead of strlen). In addition to being faster than strlen (), isset () is also valid irrespective of the existence of variables.
Cache Most PHP Scripts. The PHP developers needs keep in mind that the script execution time varies from one web server to another. For example, Apache web server provide a HTML page much quicker compared with PHP scripts. Also, it needs to recompile the PHP script whenever the page is requested for. The developers can easily eliminate the script recompilation process by caching most scripts. They also get option to minimize the script compilation time significantly by using a variety of PHP caching tools. For instance, the programmers are able to use memcache to cache a lot of scripts efficiently, along with reducing database interactions.
common asked php interview questions and answers for freshers
Execute Conditional Code with Ternary Operators. It is actually a regular practice among PHP developers to execute conditional code with If/Else statements. But the programmers want to write extra code to execute conditional code through If/Else statements. They could easily avoid writing additional code by executing conditional code through ternary operator instead of If/Else statements. The ternary operator allows programmers to keep the code clean and clutter-free by writing conditional code in a single line.
Use JSON instead of XML. When working with web services, the PHP programmers have option to utilize both XML and JSON. But they are able to take advantage of the native PHP functions like json_encode( ) and json_decode( ) to work with web services in a faster and more efficient way. They still have option to work with XML form of data. The developers are able to parse the XML data more efficiently using regular expression rather than DOM manipulation.
Replace Double Quotes with Single Quotes. When writing PHP code, developers are able to use either single quotes (') or double quotes ("). But the programmers can easily improve the functionality of the PHP application by using single quotes instead of double quotes. The singular code will speed up the execution speed of loops drastically. Similarly, the single quote will further enable programmers to print longer lines of information more effectively. However, the developers will have to make changes to the PHP code while using single quotes instead of double quotes.
Avoid Using Wildcards in SQL Queries. PHP developers typically use wildcards or * to keep the SQL queries lightweight and simple. However the use of wildcards will impact on the performance of the web application directly if the database has a higher number of columns. The developers must mention the needed columns in particular in the SQL query to maintain data secure and reduce resource consumption.
However, it is important for web developers to decide on the right PHP framework and development tool. Presently, each programmer has the option to decide on a wide range of open source PHP frameworks including Laravel, Symfony, CakePHP, Yii, CodeIgniter, and Zend. Therefore, it becomes necessary for developers to opt for a PHP that complements all the needs of a project. interview questions on PHP They also need to combine multiple PHP development tool to decrease the development time significantly and make the web app maintainable.
php interview questions for freshers
youtube
1 note
·
View note
Photo

(via PHP MCQ Question & Answer | Courseya)
0 notes
Text
Interview Questions for a Web Developer
Job Interview can be difficult, specially if you are an entry level Web Developer. However, preparing yourself for frequently asked questions may help you to avoid any difficulties.
If you already know the potential questions and answers the it will boost your confidence for the Interview and eventually you will end up making a positive impression in the interview.
In this post we will go through some of the most common interview questions & their answers for web developer.
Learn the Essentials of Website Design Course with the Best Website Design Training Institute in Pune
1. What Made You Pursue Career In Web Development?
If you are a fresher web developer then you might get asked this question frequently. Whatever your story is, find an interesting way to show your passion for coding, and how that will be of benefit to your prospective employer.
2. What Is The Difference Between Client-Side And Server-Side Scripting?
Client-side scripting refers to scripts that run on the user's browser. These scripts are downloaded to the user's computer along with the web page content, and executed there. Examples of client-side scripting languages include JavaScript, HTML, and CSS. Client-side scripting is often used to create dynamic effects and user interactions on web pages, such as pop-up windows, and animations. Server-side scripting, on the other hand, refers to scripts that run on the web server. These scripts generate the web page dynamically, and the resulting HTML is sent to the user's browser for display. Examples of server-side scripting languages include PHP, Ruby on Rails, and Python. Server-side scripting is often used for creating web applications that require more complex processing, like e-commerce sites.
3. What Programming Languages Are You Proficient In?
To answer this question, you need to be proficient in any one programing language before you appear for any interview and whenever this question is asked without hesitation speak about the language that you are most confident in.
4. Describe Your Experience With Front-End Development Technologies Such As HTML, CSS, And JavaScript.
“Practice makes man perfect” we must have heard this saying many times. To be a web developer you need to master HTML, CSS and JavaScript skills as this are the important languages for any web application development process. Describe any mini or major project that your have completed recently and confidently talk about it.
5. Explain The Difference Between HTML And XHTML – Short Answer.
HTML (Hypertext Markup Language) and XHTML (Extensible Hypertext Markup Language) are both markup languages used to create web pages. XHTML is stricter and more structured than HTML, but it also requires more attention to detail when writing code. HTML is more forgiving and easier to learn, but it may not be suitable for creating complex web applications.
6. What Is A Web API? Explain The Process Of Integrating A Third-Party API Into Your Web Application?
A web API (Application Programming Interface) is a set of protocols and tools that allow different software applications to communicate with each other over the internet. Essentially, it is a way for different software systems to exchange data and functionality, without requiring direct access to each other's code. Web APIs are commonly used to enable third-party developers to build applications that integrate with existing systems or services. They typically use standard HTTP requests and responses, and can be accessed using programming languages such as JavaScript, Python, and Ruby.
Process of integrating a third-party API into your web application: The process of integrating a third-party API into a web application involves researching the API, obtaining API credentials, testing the API, integrating the API into the application, handling errors, optimizing performance, and monitoring usage.
7. Explain The Difference Between HTTP And HTTPS? Why Is HTTPS Important For Web Security?
HTTP: HTTP is the standard protocol used for transferring data between a web server and a web client, such as a web browser. It is a clear-text protocol, which means that the data sent between the server and the client is not encrypted, making it susceptible to interception and modification by attackers. HTTP operates on port 80 by default.
HTTPS: HTTPS, on the other hand, is an encrypted version of HTTP that uses SSL/TLS (Secure Sockets Layer/Transport Layer Security) to encrypt the data sent between the server and the client. HTTPS provides a secure and encrypted connection, which makes it much more difficult for attackers to intercept or modify the data being transmitted. HTTPS operates on port 443 by default.
Why is HTTPS important for web security? HTTPS is important for web security because it encrypts data being transmitted between a web server and a client, provides data integrity, authentication, and helps prevent man-in-the-middle attacks. It's also a ranking signal for search engines, making it important for search engine optimization.
8. What Is Your Experience With Testing And Quality Assurance In Web Development?
Testing and quality assurance in web development are crucial for ensuring that web applications function as expected and meet user requirements. It involves testing for functionality, usability, security, and performance, as well as conducting quality checks to identify and address any defects or issues. Best practices include creating a testing plan, using automated testing tools, conducting user acceptance testing, performing security audits, and continuously monitoring and improving the application.
9. What Are The Differences Between A GET And A POST Request?
GET: A GET request is used to retrieve data from a server. When a GET request is sent, the data is encoded in the URL as a query string, which is visible in the address bar of the browser. This makes it easy to share and bookmark the URL. GET requests are typically used for retrieving static content, such as HTML, CSS, and JavaScript files.
POST: A POST request, on the other hand, is used to submit data to a server. When a POST request is sent, the data is sent in the request body, which is not visible in the address bar of the browser. POST requests are typically used for submitting form data, uploading files, or performing any action that modifies server-side data.
10. Explain The Box Model In CSS?
The box model in CSS is a concept that defines how elements are displayed on a web page. It consists of four components: content, padding, border, and margin. These components are displayed as a rectangular box, with the content inside and the padding, border, and margin outside. The box model determines how elements are sized and positioned on the page, and designers can adjust the values of each component to control the spacing and layout of their web pages.
11. What Is A Responsive Design? How To Create Responsive Design For A Web Application?
Responsive web design is an approach to web design that aims to create websites that can adapt to different screen sizes and devices, such as smartphones, tablets, and desktop computers. It involves using techniques such as flexible grids, responsive images, and media queries to adjust the layout and content of a website based on the screen size of the device being used. The goal of responsive web design is to provide a seamless and optimal user experience across all devices, without the need for separate mobile and desktop versions of a website.
12. How to create responsive design for a web application?
By following below steps you can create responsive design for web application.
• Use a responsive web design framework, such as Bootstrap or Foundation, to save time and effort.
• Use flexible grids, which allow you to create layouts that can adjust to different screen sizes.
• Use responsive images, media queries, and relative units for font sizes and element sizes.
• Test your design on different devices and screen sizes to ensure that it looks and functions correctly on all devices.
12. What Is AJAX? How Does It Work In Web Development?
AJAX stands for Asynchronous JavaScript and XML. It is a technique for creating dynamic and responsive web pages by sending and receiving data asynchronously with the server without having to reload the entire page. With AJAX, web applications can update content dynamically, without requiring the user to manually refresh the page. It allows for a more seamless and faster user experience, as well as reducing the amount of data transferred between the client and server. AJAX uses JavaScript to make requests to the server and manipulate the content on the page in real-time, and can use various data formats, not just XML.
13. What Are Some Ways To Optimize The Performance Of A Web Application?
Some ways to optimize the performance of a web application are:
Minimizing HTTP requests
Caching
Compressing files
Optimizing images
Minimizing code
Using a content delivery network (CDN)
Implementing lazy loading.
14. What Is Your Experience With Server-Side Languages Such As PHP Or Node.Js?
Be genuine while answering this question if you have used it then talk a short summary about it. I you have not then tell the interviewing that “I have not got a chance to work on it yet, I am a fast learner and given opportunity I can learn anything”
15. Explain The Databases MySQL Or MongoDB?
MySQL is a relational database management system (RDBMS) that is widely used for web applications. It stores data in tables and enforces relationships between them. It uses SQL (Structured Query Language) for querying and managing the data, which makes it a good choice for applications with complex data relationships.
MongoDB, on the other hand, is a NoSQL database management system that stores data in a document-based format, using BSON (Binary JSON) encoding. It does not enforce relationships between data, making it a good choice for applications with flexible data structures. It also has powerful querying capabilities and supports advanced features like geospatial indexing and aggregation.
16. What Are The Techniques Of Debugging A Web Application?
Some techniques of debugging a web application are:
• Console logging
• Breakpoints
• Code review
• Error messages
• Remote debugging
• Unit testing
• Profiling
17. What Is ReactJS Or AngularJS?
ReactJS:
ReactJS, developed by Facebook, is a component-based library for building user interfaces. It uses a virtual DOM (Document Object Model) to efficiently render changes to the UI, resulting in faster performance.
AngularJS:
AngularJS, developed by Google, is a complete framework for building web applications. It uses a two-way data binding approach and a component-based architecture for building user interfaces
18. Explain CSS Pre-processors Such As SASS Or LESS?
CSS pre-processors such as SASS (Syntactically Awesome Style Sheets) and LESS (Leaner Style Sheets) are tools that extend the capabilities of CSS (Cascading Style Sheets).
These pre-processors allow developers to write CSS in a more organized and efficient way, using features such as variables, functions, and mixins. This makes it easier to maintain and modify the styles of a web application, as changes can be made in one place and applied throughout the entire project.
SASS and LESS both use a syntax that is similar to CSS, with some added features. SASS uses a syntax that is similar to traditional programming languages, with curly braces and semicolons, while LESS uses a more CSS-like syntax with nested rules.
Overall, CSS pre-processors are valuable tools for web developers looking to write more efficient and maintainable CSS code for their web applications.
19. Can You Describe A Recent Project You Worked On And What Challenges You Faced?
Again, your genuine nature is really important in the interview so whichever project you have worked on talk about it freely.
20. What Is CMS (Content Management System)
A CMS (content management system) is a software application that enables users to create, manage, and publish digital content for websites. It provides an easy-to-use interface with features such as editing tools, media management, content organization, and user management, allowing website owners and content creators to publish content without requiring extensive knowledge of coding or web development.
These are just a few examples of the types of technical interview questions that web developers may have to face. It's important to It's important to prepare ahead of time to be able to explain your skills and experience through coding challenges or examples of past projects. (Link) Best Web Development Course in Pune at CodeShip Technologies is the best option to make a career as a web developer. Here you will learn practical concepts of web development and upon completion of your course you would become a proficient and job ready Website Developer.
#webdesigncourses#Web development services#Web development training institute#Web development courses#Web development#Website development#Web development training in India
0 notes
Link
1 note
·
View note
Link
At codingtag.com we understand the challenge face at interview so we have prepared the list of important List of Top PHP Questions and Answers for Freshers and Experienced in 2020 to help you get through any difficulty.
0 notes
Text
HOW TO PREPARE FOR CAMPUS 2021 PLACEMENTS @ NCU
The North Cap University is known for the best campus placements and SPA provides placements support to all the focused students. Now we have three months left before the campus season starts for 2021 graduating students. This is the time when all of you must start preparing for earning a suitable job as per your competencies and aspiration. We the School of Professional Attachment joining you to help in your preparation for upcoming placement season. Let’s start working step by step on key prerequisites for Campus 2021. 1. Previous Recruiters. 2. Understanding about the requirements. 3. Evaluate & relate yourself. 4. Placement preparation essentials. 5. General Preparation.
1. Previous Recruiters: Our last two years placements and recruiters are really help you understand about the type of companies visit NCU for hiring freshers.On the basis of those recruiters you can design your path for upcoming placement season.
All previous year recruiters detail are already published on SPA portal. If you are really interested for campus placement then you have to register yourself on SPA portal properly including all the required information with passport size formal photograph.
Research about at least 20 previous year’s recruiter as per your suitability and interests. Take all the relevant information about those companies likes,
• What is the hiring plan of the company? • Is there any expansion or merger going on? • Track record of our alumni in the company • Profile they offer for fresher’s • Reason for choosing this company as your perspective employer.
2. Understanding about the requirements. Each and every company has their different eligibility criteria for hiring the fresher’s from NCU. You have to take complete understanding about their requirements then choose the company to go ahead.
3. Evaluate & relate yourself. To identify your internal strengths and weaknesses, as well as external opportunities and threats you have to evaluate yourself firs then relate with the organizational needs as a fresher. Most of the companies visited hear at NCU are very clear about their requirements which is plainly mentioned in the job description.
Check you CGPA first then match with the company requirements, if you are fulfilling those requirements then aspire for that company.
4. Placement preparation essentials. Following are the essential ingredients for campus placements preparation. • Basic Engineering Knowledge. • Aptitude test • Programming Language • Communication Skill • Technical Interview • HR Interview • Crisp Resume. • Stress Management
o Basic Engineering Knowledge. The most basic ingredient that identifies you as an engineer is the knowledge in your field of study. Companies are keen for engineers, who prove that they can call upon the relevant skills as and when required.
o Aptitude test Employers use aptitude tests to help them make the right hiring decision; aptitude tests are an authenticated tool used to identify those who are best equipped to carry out any given role. Find out the company wise aptitude test format as the employers are growingly testing candidates using computers so it’s most important to practice questions in that format. Keep practicing daily till the placement season starts and don’t fool yourself and think you don’t need to practice as many questions as possible.
o Programming Language It is recommended to be aware of at least one basic programming language thoroughly which may be Java, Python, Java Script, C++, PHP etc.
o Communication Skill Communication skill with positive body language and formal dress code always get plus points for you. You are going to be tested not only for what you know about your area of expertise but also on how you present yourself at the interview.
o Technical Interview Technical interviews involve calling someone to participate in a competitive situation and assignments which is more like an exam than a typical question-and-answer interview. The purpose of the technical interview is not to evaluate you with intentionally phrased or impossible questions. Instead, it’s to see how you tackle real-world problems–like the ones you might be facing once you have the job. Some of the widely used forms of technical Interviews are, a. Pen Paper coding assignment. b. Whiteboard assignment.
o HR Interview. The HR round is generally the last round in the recruitment process of any company. Good academic records and sound technical knowledge alone are not sufficient to guarantee you a Job.
Every company conducts an HR interview round to judge your • Personality, • Strengths & weaknesses, • Capability to handle the given situation, • Job Fitment
HR Interview is also an elimination round.
Some important tips: • Research the complete information about the company. • Honesty is the first and the foremost thing that is needed to be taken care of. • Do not bluff in front of the HR manager, be yourself. • Try to avoid giving irrelevant answers.
• Interact with the HR manager during the interview and ask some relevant question about the company and profile.
o Crisp Resume. Keeps your Resume crisp & short preferably lasting for one-two pages which should contain your key academic achievements, highlights of projects and extra-curricular activities. Explain all the relevant points that you have mentioned in the resume and this defines your communication skills in the initial stage.
Try to picture in mind the achievements during your academics, which you have mentioned in the resume and you are going to tell during the interview.
Don’t write something that you don’t understand.
o Stress Management Many candidates find it difficult to handle stress level before an interview.
Being stressed is natural but you should learn to clear it off. An optimum level of stress is needed and is natural with all of us.
Once you come to know about it, you will be able to beat it. Do not bother about it. Just take a long breathe and nervousness will go away.
5. General Preparation. Formal dress code is recommended for a job interview as your dressing sense is a part of your personality.
Meet the interviewers warmly and offer a strong handshake to them. Smile on your face reflects a charming personality.
It is really important is to be crisp, clean and sharp during the interview.
Participate in mock interviews as many as you can with the help of your batch mates, faculty members, seniors and alumnus together with practice your articulation skill and improve it. Many of the student are lacking in this area.
School Of Profectional Attachment The NorthCap University, Gurugram
0 notes
Text
5 Top PHP Interview Questions and Answers in 2022
PHP is one of the most popular programming languages and is used by a variety of companies to create web applications. As such, PHP interviews are increasingly common in the job market. With PHP being so popular, it's important to be prepared for your PHP interview. To help you get ready, here are 5 top PHP interview questions and answers for fresher that freshers should know in 2022:

What is PHP?
Answer: PHP stands for Hypertext Preprocessor and is a server-side scripting language used to develop dynamic websites and web applications. It can be embedded into HTML code and allows developers to easily manipulate data stored in databases such as MySQL or Oracle.
What is the difference between PHP and HTML?
Answer: PHP is a server-side scripting language while HTML is a client-side markup language. PHP files are run on the server, which generates the HTML code that is then sent to the browser. PHP can also manipulate and retrieve data from databases while HTML cannot.
What are some advantages of using PHP?
Answer: PHP has many advantages such as being open source, easy to learn and deploy, fast development time, compatibility with multiple operating systems and web servers, support for different databases, scalability etc.
How do you define variables in PHP?
Answer: Variables are declared in PHP by preceding their name with a dollar sign ($). For example: $variableName = "value";
What is the importance of PHP frameworks?
Answer: PHP frameworks provide a structured environment for faster web development. They are based on the Model-View-Controller (MVC) pattern, which helps developers to organize their code into logical modules and build applications with fewer bugs. PHP frameworks also help developers to create secure and reliable websites quicker than starting from scratch. Popular PHP frameworks include Symfony, Laravel, CakePHP, Zend Framework, etc.
Please Also Check-Out These Topic :
Difference between post and get method
Indian pan card validation in javascript
Difference between myisam and innodb
Best Free WordPress Hosting
0 notes
Text
300+ TOP ORACLE Database Interview Questions and Answers
ORACLE Database Interview Questions for freshers experienced :-
1. What Is Oracle? Oracle is a company. Oracle is also a database server, which manages data in a very structured way. It allows users to store and retrieve related data in a multiuser environment so that many users can concurrently access the same data. All this is accomplished while delivering high performance. A database server also prevents unauthorized access and provides efficient solutions for failure recovery. 2. What Is an Oracle Database? An Oracle database is a collection of data treated as a big unit in the database server. 3. What Is an Oracle Instance? Every running Oracle database is associated with an Oracle instance. When a database is started on a database server (regardless of the type of computer), Oracle allocates a memory area called the System Global Area (SGA) and starts one or more Oracle processes. This combination of the SGA and the Oracle processes is called an Oracle instance. The memory and processes of an instance manage the associated database's data efficiently and serve the one or multiple users of the database. 4. What Is a Parameter File in Oracle? A parameter file is a file that contains a list of initialization parameters and a value for each parameter. You specify initialization parameters in a parameter file that reflect your particular installation. Oracle supports the following two types of parameter files: * Server Parameter Files - Binary version. Persistent. * Initialization Parameter Files - Text version. Not persistent. 5. What Is a Server Parameter File in Oracle? A server parameter file is a binary file that acts as a repository for initialization parameters. The server parameter file can reside on the machine where the Oracle database server executes. Initialization parameters stored in a server parameter file are persistent, in that any changes made to the parameters while an instance is running can persist across instance shutdown and startup. 6. What Is a Initialization Parameter File in Oracle? An initialization parameter file is a text file that contains a list of initialization parameters. The file should be written in the client's default character set. Sample initialization parameter files are provided on the Oracle distribution medium for each operating system. A sample file is sufficient for initial use, but you will probably want to modify the file to tune the database for best performance. Any changes will take effect after you completely shut down and restart the instance. 7. What is System Global Area (SGA) in Oracle? The System Global Area (SGA) is a memory area that contains data shared between all database users such as buffer cache and a shared pool of SQL statements. The SGA is allocated in memory when an Oracle database instance is started, and any change in the value will take effect at the next startup. 8. What is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is allocated for each individual database session and it contains session specific information such as SQL statement data or buffers used for sorting. The value specifies the total memory allocated by all sessions, and changes will take effect as new sessions are started. 9. What Is a User Account in Oracle? A user account is identified by a user name and defines the user's attributes, including the following: Password for database authentication Privileges and roles Default tablespace for database objects Default temporary tablespace for query processing work space 10. What Is the Relation of a User Account and a Schema in Oracle? User accounts and schemas have a one-to-one relation. When you create a user, you are also implicitly creating a schema for that user. A schema is a logical container for the database objects (such as tables, views, triggers, and so on) that the user creates. The schema name is the same as the user name, and can be used to unambiguously refer to objects owned by the user.
ORACLE Database Interview Questions 11. What Is a User Role in Oracle? A user role is a group of privileges. Privileges are assigned to users through user roles. You create new roles, grant privileges to the roles, and then grant roles to users. 12. What is a Database Schema in Oracle? A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. Schema objects can be created and manipulated with SQL and include: tables, views, and other types of data objects. 13. What Is a Database Table in Oracle? A database table is a basic unit of data logical storage in an Oracle database. Data is stored in rows and columns. You define a table with a table name, such as employees, and a set of columns. You give each column a column name, such as employee_id, last_name, and job_id; a datatype, such as VARCHAR2, DATE, or NUMBER; and a width. The width can be predetermined by the datatype, as in DATE. If columns are of the NUMBER datatype, define precision and scale instead of width. A row is a collection of column information corresponding to a single record. 14. What Is a Table Index in Oracle? Index is an optional structure associated with a table that allow SQL statements to execute more quickly against a table. Just as the index in this manual helps you locate information faster than if there were no index, an Oracle Database index provides a faster access path to table data. You can use indexes without rewriting any queries. Your results are the same, but you see them more quickly. 15. What Is an Oracle Tablespace? An Oracle tablespace is a big unit of logical storage in an Oracle database. It is managed and used by the Oracle server to store structures data objects, like tables and indexes. 16. What Is an Oracle Data File? An Oracle data file is a big unit of physical storage in the OS file system. One or many Oracle data files are organized together to provide physical storage to a single Oracle tablespace. 17. What Is a Static Data Dictionary in Oracle? Data dictionary tables are not directly accessible, but you can access information in them through data dictionary views. To list the data dictionary views available to you, query the view DICTIONARY. Many data dictionary tables have three corresponding views: * An ALL_ view displays all the information accessible to the current user, including information from the current user's schema as well as information from objects in other schemas, if the current user has access to those objects by way of grants of privileges or roles. * A DBA_ view displays all relevant information in the entire database. DBA_ views are intended only for administrators. They can be accessed only by users with the SELECT ANY TABLE privilege. This privilege is assigned to the DBA role when the system is initially installed. * A USER_ view displays all the information from the schema of the current user. No special privileges are required to query these views. 18. What Is a Dynamic Performance View in Oracle? Oracle contains a set of underlying views that are maintained by the database server and accessible to the database administrator user SYS. These views are called dynamic performance views because they are continuously updated while a database is open and in use, and their contents relate primarily to performance. Although these views appear to be regular database tables, they are not. These views provide data on internal disk structures and memory structures. You can select from these views, but you can never update or alter them. 19. What Is a Recycle Bin in Oracle? Recycle bin is a logical storage to hold the tables that have been dropped from the database, in case it was dropped in error. Tables in recycle bin can be recovered back into database by the Flashback Drop action. Oracle database recycle save the same purpose as the recycle bin on your Windows desktop. Recycle bin can be turned on or off in the recyclebin=on/off in your parameter file. 20. What Is SQL*Plus? SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface. 21. What Is Transport Network Substrate (TNS) in Oracle? TNS, Transport Network Substrate, is a foundation technology, built into the Oracle Net foundation layer that works with any standard network transport protocol. 22. What Is Open Database Communication (ODBC) in Oracle? ODBC, Open Database Communication, a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems. Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC. 23. What is Oracle Database 10g Express Edition? Based on Oracle Web site: Oracle Database 10g Express Edition (Oracle Database XE) is an entry-level, small-footprint database based on the Oracle Database 10g Release 2 code base that's free to develop, deploy, and distribute; fast to download; and simple to administer. Oracle Database XE is a great starter database for: Developers working on PHP, Java, .NET, and Open Source applications DBAs who need a free, starter database for training and deployment Independent Software Vendors (ISVs) and hardware vendors who want a starter database to distribute free of charge Educational institutions and students who need a free database for their curriculum 24. What Are the Limitations Oracle Database 10g XE? Oracle Database XE is free for runtime usage with the following limitations: Supports up to 4GB of user data (in addition to Oracle system data) Single instance only of Oracle Database XE on any server May be installed on a multiple CPU server, but only executes on one processor in any server May be installed on a server with any amount of memory, but will only use up to 1GB RAM of available memory 25. What Operating Systems Are Supported by Oracle Database 10g XE? Oracle Database 10g Express Edition is available for two types of operating Systems: Linux x86 - Debian, Mandriva, Novell, Red Hat and Ubuntu Microsoft Windows 26. How To Download Oracle Database 10g XE? If you want to download a copy of Oracle Database 10g Express Edition, visit http://www.oracle.com/technology/software/products/database/xe/. If you are using Windows systems, there are downloads available for you: Oracle Database 10g Express Edition (Western European) - Single-byte LATIN1 database for Western European language storage, with the Database Homepage user interface in English only. Oracle Database 10g Express Edition (Universal) - Multi-byte Unicode database for all language deployment, with the Database Homepage user interface available in the following languages: Brazilian Portuguese, Chinese (Simplified and Traditional), English, French, German, Italian, Japanese, Korean and Spanish. Oracle Database 10g Express Client You need to download the universal edition, OracleXEUniv.exe, (216,933,372 bytes) and client package, OracleXEClient.exe (30,943,220 bytes). 27. How To Install Oracle Database 10g XE? To install 10g universal edition, double click, OracleXEUniv.exe, the install wizard starts. It will guide you to finish the installation process. You should take notes about: The SYSTEM password you selecte: atoztarget. Database server port: 1521. Database HTTP port: 8080. MS Transaction Server port: 2030. The directory where 10g XE is installed: oraclexe Hard disk space taken: 1655MB. 28. How To Check Your Oracle Database 10g XE Installation? If you want to check your fresh installation of 10g Express Edition without using any special client programs, you can use a Web browser with this address, http://localhost:8080/apex/. You will see the login page. Enter SYSTEM as the user name, and the password (atoztarget), you selected during the installation to log into the server. Visit different areas on your 10g XE server home page to make sure your server is running OK. You can also get to your 10g XE server home page by going through the start menu. Select All Programs, then Oracle Database 10g Express Edition, and then Go To Database Home Page 29. How To Shutdown Your 10g XE Server? If you want to shutdown your 10g Express Edition server, go to the Services manager in the control panel. You will a service called OracleServiceXE, which represents your 10g Express Edition server. Select OracleServiceXE, and use the right mouse click to stop this service. This will shutdown your 10g Express Edition server. You can also shutdown your 10g XE server through the start menu. Select All Programs, then Oracle Database 10g Express Edition, and then Stop Database. 30. How To Start Your 10g XE Server? Go to the Start menu, select All Programs, Oracle Database 10g Express Edition, and Start Database. 31. How Much Memory Your 10g XE Server Is Using? Your 10g XE Server is using about 180MB of memory even there is no users on the server. The server memory usage is displayed on your server home page, if you log in as SYSTEM. 32. How To Start Your 10g XE Server from Command Line? You can start your 10g XE server from command line by: Open a command line window. Change directory to oraclexeapporacleproduct10.2.0serverBIN. Run StartDB.bat. The batch file StartDB.bat contains: net start OracleXETNSListener net start OracleServiceXE @oradim -startup -sid XE -starttype inst > nul 2>&1 33. How To Shutdown Your 10g XE Server from Command Line? You can shutdown your 10g XE server from command line by: Open a command line window. Change directory to oraclexeapporacleproduct10.2.0serverBIN. Run StopDB.bat. The batch file StopDB.bat contains: net stop OracleServiceXE 34. How To Unlock the Sample User Account in Oracle? Your 10g XE server comes with a sample database user account called HR. But this account is locked. You must unlock it before you can use it: Log into the server home page as SYSTEM. Click the Administration icon, and then click Database Users. Click the HR schema icon to display the user information for HR. Enter a new password (hr) for HR, and change the status to Unlocked. Click Alter User to save the changes. Now user account HR is ready to use. 35. How To Change System Global Area (SGA) in Oracle? Your 10g XE server has a default setting for System Global Area (SGA) of 140MB. The SGA size can be changed to a new value depending on how many concurrent sessions connecting to your server. If you are running this server just for yourself to improve your DBA skill, you should change the SGA size to 32MB by: Log into the server home page as SYSTEM. Go to Administration, then Memory. Click Configure SGA. Enter the new memory size: 32 Click Apply Changes to save the changes. Re-start your server. 36. How To Change Program Global Area (PGA) in Oracle? Your 10g XE server has a default setting for Program Global Area (PGA) of 40MB. The PGA size can be changed to a new value depending on how much data a single session should be allocated. If you think your session will be short with a small amount of data, you should change the PGA size to 16MB by: Log into the server home page as SYSTEM. Go to Administration, then Memory. Click Configure PGA. Enter the new memory size: 16 Click Apply Changes to save the changes. Re-start your server. 37. What Happens If You Set the SGA Too Low in Oracle? Let's you made a mistake and changed to SGA to 16MB from the SYSTEM admin home page. When you run the batch file StartDB.bat, it will return a message saying server stated. However, if you try to connect to your server home page: http://localhost:8080/apex/, you will get no response. Why? Your server is running, but the default instance XE was not started. If you go the Control Panel and Services, you will see service OracleServiceXE is listed not in the running status. 38. What To Do If the StartBD.bat Failed to Start the XE Instance? If StartBD.bat failed to start the XE instance, you need to try to start the instance with other approaches to get detail error messages on why the instance can not be started. One good approach to start the default instance is to use SQL*Plus. Here is how to use SQL*Plus to start the default instance in a command window: >cd (OracleXE home directory) >.binstartdb >.binsqlplus Enter user-name: SYSTEM Enter password: atoztarget ERROR: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist The first "cd" is to move the current directory the 10g XE home directory. The second command ".binstartdb" is to make sure the TNS listener is running. The third command ".binsqlplus" launches SQL*Plus. The error message "ORA-27101" tells you that there is a memory problem with the default instance. So you can not use the normal login process to the server without a good instance. See other tips on how to log into a server without any instance. 39. How To Login to the Server without an Instance? If your default instance is in trouble, and you can not use the normal login process to reach the server, you can use a special login to log into the server without any instance. Here is how to use SQL*Plus to log in as as a system BDA: >cd (OracleXE home directory) >.binstartdb >.binsqlplus Enter user-name: SYSTEM/atoztarget AS SYSDBA Connected to an idle instance SQL> show instance instance "local" The trick is to put user name, password and login options in a single string as the user name. "AS SYSDBA" tells the server to not start any instance, and connect the session the idle instance. Log in as SYSDBA is very useful for performing DBA tasks. 40. How To Use "startup" Command to Start Default Instance? If you logged in to the server as a SYSDBA, you start the default instance with the "startup" command. Here is how to start the default instance in SQL*Plus in SYSDBA mode: >.binsqlplus Enter user-name: SYSTEM/atoztarget AS SYSDBA Connected to an idle instance SQL> show instance instance "local" SQL> startup ORA-00821: Specified value of sga_target 16M is too small, needs to be at least 20M Now the server is telling you more details about the memory problem on your default instance: your SGA setting of 16MB is too small. It must be increased to at least 20MB. 41. Where Are the Settings Stored for Each Instance in Oracle? Settings for each instance are stored in a file called Server Parameter File (SPFile). Oracle supports two types of parameter files, Text type, and Binary type. parameter files should be located in $ORACLE_HOMEdatabase directory. A parameter file should be named like "init$SID.ora", where $SID is the instance name. 42. What To Do If the Binary SPFile Is Wrong for the Default Instance? Let's say the SPFile for the default instance is a binary file, and some settings are wrong in the SPFile, like SGA setting is bellow 20MB, how do you change a setting in the binary file? This seems to be a hard task, because the binary SPFile is not allowed to be edited manually. It needs to be updated by the server with instance started. But you can not start the instance because the SPFile has a wrong setting. One way to solve the problem is to stop using the binary SPFile, and use a text version of the a parameter file to start the instance. Here is an example of how to use the backup copy (text version) of the parameter file for the default instance to start the instance: >.binsqlplus Enter user-name: SYSTEM/atoztarget AS SYSDBA Connected to an idle instance 43. How To Check the Server Version in Oracle? Oracle server version information is stored in a table called: PRODUCT_COMPONENT_VERSION. You can use a simple SELECT statement to view the version information like this: >.binsqlplus Enter user-name: SYSTEM/atoztarget AS SYSDBA Connected to an idle instance SQL> COL PRODUCT FORMAT A35 SQL> COL VERSION FORMAT A15 SQL> COL STATUS FORMAT A15 SQL> SELECT * FROM PRODUCT_COMPONENT_VERSION; PRODUCT VERSION STATUS ----------------------------------- ----------- ---------- NLSRTL 10.2.0.1.0 Production Oracle Database 10g Express Edition 10.2.0.1.0 Product PL/SQL 10.2.0.1.0 Production TNS for 32-bit Windows: 10.2.0.1.0 Production 44. Explain What Is SQL*Plus? SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface. SQL*Plus has its own commands and environment, and it provides access to the Oracle Database. It enables you to enter and execute SQL, PL/SQL, SQL*Plus and operating system commands to perform the following: Format, perform calculations on, store, and print from query results Examine table and object definitions Develop and run batch scripts Perform database administration You can use SQL*Plus to generate reports interactively, to generate reports as batch processes, and to output the results to text file, to screen, or to HTML file for browsing on the Internet. You can generate reports dynamically using the HTML output facility of SQL*Plus, or using the dynamic reporting capability of iSQL*Plus to run a script from a web page. 45. How To Start the Command-Line SQL*Plus? f you Oracle server or client installed on your windows system, you can start the command-line SQL*Plus in two ways: 1. Click Start > All Programs > Oracle ... > Start SQL Command Line. The SQL*Plus command window will show up with a message like this: SQL*Plus: Release 10.2.0.1.0 - Production on Tue ... Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> 2. Click Start > Run..., enter "cmd" and click OK. A Windows command window will show up. You can then use Windows commands to start the command-line SQL*Plus as shown in the tutorial exercise below: >cd c:oraclexeapporacleproduct10.2.0server >.binsqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on Tue ... Copyright (c) 1982, 2005, Oracle. All rights reserved. 46. How To Get Help at the SQL Prompt? Once SQL*Plus is started, you will get a SQL prompt like this: SQL>. This where you can enter commands for SQL*Plus to run. To get help information at the SQL prompt, you can use the HELP command as shown in the following tutorial example: SQL> HELP INDEX Enter Help for help. @ COPY PAUSE SHUTDOWN @@ DEFINE PRINT SPOOL / DEL PROMPT SQLPLUS ACCEPT DESCRIBE QUIT START APPEND DISCONNECT RECOVER STARTUP ARCHIVE LOG EDIT REMARK STORE ATTRIBUTE EXECUTE REPFOOTER TIMING BREAK EXIT REPHEADER TTITLE ... COMPUTE LIST SET XQUERY CONNECT PASSWORD SHOW SQL> HELP CONNECT CONNECT ------ 47. What Information Is Needed to Connect SQL*Plus an Oracle Server? If you want to connect your SQL*Plus session to an Oracle server, you need to know the following information about this server: The network hostname, or IP address, of the Oracle server. The network port number where the Oracle server is listening for incoming connections. The name of the target database instance managed by the Oracle server. The name of your user account predefined on in the target database instance. The password of your user account predefined on in the target database instance. 48. What Is a Connect Identifier? A "connect identifier" is an identification string of a single set of connection information to a specific target database instance on a specific Oracle server. Connect identifiers are defined and stored in a file called tnsnames.ora located in $ORACLE_HOME/network/admin/ directory. Here is one example of a "connect identifier" definition: ggl_XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = www.atoztarget.com) (PORT = 1521) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) The above "connect identifier" defines "TNS_XE" with the following connection information: * The network hostname: www.atoztarget.com. * The network port number: 1521. * The name of the target database instance: XE. 49. How To Connect a SQL*Plus Session to an Oracle Server? In order to connect a SQL*Plus session to an Oracle server, you need to: 1. Obtain the connection information from the Oracle server DBA. 2. Define a new "connect identifier" called "ggl_XE" in your tnsnames.org file with the given connection information. 3. Run the CONNECT command in SQL*Plus as shown in the tutorial exercise below: >cd c:oraclexeapporacleproduct10.2.0server >.binsqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on Tue ... Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> CONNECT ggl/retneclgg@ggl_XE; Connected. SQL> SELECT SYSDATE FROM DUAL; SYSDATE --------- 05-MAR-06 50. What Happens If You Use a Wrong Connect Identifier? Of course, you will get an error, if you use a wrong connect identifier. Here is an example of how SQL*Plus react to a wrong connect identifier: SQL> CONNECT ggl/retneclgg@WRONG; ERROR: ORA-12154: TNS:could not resolve the connect identifier specified Warning: You are no longer connected to ORACLE. What you need to do in this case: Check the CONNECT command to make sure that the connect identifier is entered correctly. Check the tnsnames.ora file to make sure that the connect identifier is defined correctly. Check the tnsnames.ora file to make sure that there is no multiple definitions of the same connect identifier. Check your files system to see if you have multiple copies of tnsnames.ora in different Oracle home directories, because you installed multiple versions of Oracle. If you do have multiple copies, make sure your SQL*Plus session is picking up the correct copy of tnsnames.ora. 51. What To Do If DBA Lost the SYSTEM Password? If the DBA lost the password of the SYSTEM user account, he/she can go to the Oracle server machine, and run SQL*Plus on server locally with the operating system authentication method to gain access to the database. The tutorial exercise below shows you how: (Terminal server to the Oracle server machine) (Start SQL*Plus) SQL>CONNECT / AS SYSDBA Connected. SQL> ALTER USER SYSTEM IDENTIFIED BY ssap_lgg; User altered. Notice that the (/) in the CONNECT command tells SQL*Plus to use the current user on local operating system as the connection authentication method. 52. What Types of Commands Can Be Executed in SQL*Plus? There are 4 types of commands you can run at the SQL*Plus command line prompt: 1. SQL commands - Standard SQL statements to be executed on target database on the Oracle server. For example: "SELECT * FROM ggl_faq;" is a SQL command. 2. PL/SQL commands - PL/SQL statements to be executed by the Oracle server. For example: "EXECUTE DBMS_OUTPUT.PUT_LINE('Welcome to www.atoztarget.com')" runs a PL/SQL command. SQL*Plus commands - Commands to be executed by the local SQL*Plus program itself. For example: "SET NULL 'NULL'" is a SQL*Plus command. OS commands - Commands to be executed by the local operating system. For example: "HOST dir" runs an operating system command on the local machine. 53. How To Run SQL Commands in SQL*Plus? If you want to run a SQL command in SQL*Plus, you need to enter the SQL command in one or more lines and terminated with (;). The tutorial exercise below shows a good example: SQL> SELECT 'Welcome!' FROM DUAL; 'WELCOME -------- Welcome! SQL> SELECT 'Welcome to atoztarget.com tutorials!' 2 FROM DUAL 3 ; 'WELCOMETOatoztarget.COMTUTORIALS!' ----------------------------------- Welcome to atoztarget.com tutorials! 54. How To Run PL/SQL Statements in SQL*Plus? If you want to run a single PL/SQL statement in SQL*Plus, you need to use the EXECUTE command as shown in the following tutorial example: SQL> SET SERVEROUTPUT ON SQL> EXECUTE DBMS_OUTPUT.PUT_LINE('Welcome to atoztarget!') Welcome to atoztarget! PL/SQL procedure successfully completed. 55. How To Change SQL*Plus System Settings? SQL*Plus environment is controlled a big list of SQL*Plus system settings. You can change them by using the SET command as shown in the following list: * SET AUTOCOMMIT OFF - Turns off the auto-commit feature. * SET FEEDBACK OFF - Stops displaying the "27 rows selected." message at the end of the query output. * SET HEADING OFF - Stops displaying the header line of the query output. * SET LINESIZE 256 - Sets the number of characters per line when displaying the query output. * SET NEWPAGE 2 - Sets 2 blank lines to be displayed on each page of the query output. * SET NEWPAGE NONE - Sets for no blank lines to be displayed on each page of the query output. * SET NULL 'null' - Asks SQL*Plus to display 'null' for columns that have null values in the query output. * SET PAGESIZE 60 - Sets the number of lines per page when displaying the query output. * SET TIMING ON - Asks SQL*Plus to display the command execution timing data. * SET WRAP OFF - Turns off the wrapping feature when displaying query output. 56. How To Look at the Current SQL*Plus System Settings? If you want to see the current values of SQL*Plus system settings, you can use the SHOW command as shown in the following tutorial exercise: SQL> SHOW AUTOCOMMIT autocommit OFF SQL> SHOW HEADING heading ON SQL> SHOW LINESIZE linesize 80 SQL> SHOW PAGESIZE pagesize 14 SQL> SHOW FEEDBACK FEEDBACK ON for 6 or more rows SQL> SHOW TIMING timing OFF SQL> SHOW NULL null "" SQL> SHOW ALL appinfo is OFF and set to "SQL*Plus" arraysize 15 autocommit OFF autoprint OFF autorecovery OFF autotrace OFF blockterminator "." (hex 2e) cmdsep OFF colsep " " compatibility version NATIVE concat "." (hex 2e) copycommit 0 COPYTYPECHECK is ON define "&" (hex 26) describe DEPTH 1 LINENUM OFF INDENT ON echo OFF 57. What Are SQL*Plus Environment Variables? Behaviors of SQL*Plus are also controlled a some environment variables predefined on the local operating system. Here are some commonly used SQL*Plus environment variables: * ORACLE_HOME - The home directory where your Oracle client application is installed. * PATH - A list of directories where SQL*Plus will search for executable or DLL files. PATH should include $ORACLE_HOMEbin. * SQLPLUS - The directory where localization messages are stored. SQLPLUS should be set to $ORACLE_HOMEsqlplusmesg * TNS_ADMIN - The directory where the connect identifier file, tnsnames.ora is located. TNS_ADMIN should be set to $ORACLE_HOME/network/admin. 58. How To Generate Query Output in HTML Format? If you want your query output to be generated in HTML format, you can use the "SET MARKUP HTML ON" to turn on the HTML feature. The following tutorial exercise gives you a good example: SQL> connect HR/retneclgg SQL> SET MARKUP HTML ON SQL> SELECT FIRST_NAME, LAST_NAME, HIRE_DATE 2 FROM EMPLOYEES WHERE FIRST_NAME LIKE 'Joh%'; FIRST_NAME LAST_NAME HIRE_DATE John Seo 12-FEB-98 John Russell 01-OCT-96 59. What Is Output Spooling in SQL*Plus? The output spooling a nice feature of the command-line SQL*Plus tool. If the spooling feature is turned on, SQL*Plus will send a carbon copy of the everything on your screen to a specified local file. Output spooling is used mostly for quick dump of data to local files. Here are the commands to turn on and off output spooling in SQL*Plus: * SPOOL fileName - Turning on output spooling with the specified file. * SPOOL OFF - Turning off output spooling and close the spool file. 60. How To Save Query Output to a Local File? Normally, when you run a SELECT statement in SQL*Plus, the output will be displayed on your screen. If you want the output to be saved to local file, you can use the "SPOOL fileName" command to specify a local file and start the spooling feature. When you are done with your SELECT statement, you need to close the spool file with the "SPOOL OFF" command. The following tutorial exercise gives you a good example: SQL> connect HR/retneclgg SQL> SET HEADING OFF SQL> SET FEEDBACK OFF SQL> SET LINESIZE 1000 SQL> SPOOL tempemployees.lst SQL> SELECT * FROM EMPLOYEES; ...... SQL> SPOOL OFF You should get all records in employees.lst with fixed length fields. 61. What Is Input Buffer in SQL*Plus? Input buffer is a nice feature of the command-line SQL*Plus tool. It allows you to revise a multiple-line command and re-run it with a couple of simple commands. By default, input buffer is always turned on in SQL*Plus. The last SQL statement is always stored in the buffer. All you need is to remember to following commonly used commands: * LIST - Displays the SQL statement (the last executed SQL statement) in the buffer. * RUN - Runs the SQL statement in the buffer again. ";" is a quick command equivalent to RUN. * CLEAR BUFFER - Removes the SQL statement in the buffer. * INPUT line - Adds a new line into the buffer. * APPEND text - Appends more text to the last line in the buffer. * DEL - Deletes one line from the buffer. * CHANGE /old/new - Replaces 'old' text with 'new' text in the buffer. 62. How To Revise and Re-Run the Last SQL Command? If executed a long SQL statement, found a mistake in the statement, and you don't want enter that long statement again, you can use the input buffer commands to the correct last statement and re-run it. The following tutorial exercise gives you a good example: SQL> connect HR/retneclgg SQL> SELECT FIRST_NAME, LAST_NAME, HIRE_DATE 2 FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%'; FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%' * ERROR at line 2: ORA-00942: table or view does not exist SQL> LIST 1 SELECT FIRST_NAME, LAST_NAME, HIRE_DATE 2* FROM EMPLOYEES WHERE FIRST_NAME LIKE 'Joh%' SQL> CHANGE /EMPLOYEE/EMPLOYEES/ 2* FROM EMPLOYEES WHERE FIRST_NAME LIKE 'Joh%' SQL> RUN (Query output) SQL> INPUT ORDER BY FIRE_DATE SQL> LIST 1 SELECT FIRST_NAME, LAST_NAME, HIRE_DATE 2 FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%' 3* ORDER BY HIRE_DATE SQL> RUN (Query output) SQL> CLEAR BUFFER buffer cleared SQL> LIST SP2-0223: No lines in SQL buffer. 63. How Run SQL*Plus Commands That Are Stored in a Local File? If you have a group of commands that you need to run them repeatedly every day, you can save those commands in a file (called SQL script file), and using the "@fileName" command to run them in SQL*Plus. If you want to try this, create a file called tempinput.sql with: SELECT 'Welcome to' FROM DUAL; SELECT 'atoztarget.com!' FROM DUAL; Then run the "@" command in SQL*Plus as: SQL> connect HR/retneclgg SQL> @tempinput.sql 'WELCOMETO ---------- Welcome to 'atoztarget.COM -------------- atoztarget.com! 64. How To Use SQL*Plus Built-in Timers? If you don't have a stopwatch/timer and want to measure elapsed periods of time, you can SQL*Plus Built-in Timers with the following commands: * TIMING - Displays number of timers. * TIMING START - Starts a new timer with or without a name. * TIMING SHOW - Shows the current time of the named or not-named timer. * TIMING STOP - Stops the named or not-named timer. The following tutorial exercise shows you a good example of using SQL*Plus built-in timers: SQL> TIMING START timer_1 (some seconds later) SQL> TIMING START timer_2 (some seconds later) SQL> TIMING START timer_3 (some seconds later) SQL> TIMING SHOW timer_1 timing for: timer_2 Elapsed: 00:00:19.43 (some seconds later) SQL> TIMING STOP timer_2 timing for: timer_2 Elapsed: 00:00:36.32 SQL> TIMING 2 timing elements in use 65. What Is Oracle Server Autotrace in Oracle? Autotrace is Oracle server feature that generates two statement execution reports very useful for performance tuning: * Statement execution path - Shows you the execution loop logic of a DML statement. * Statement execution statistics - Shows you various execution statistics of a DML statement. To turn on the autotrace feature, the Oracle server DBA need to: * Create a special table called PLAN_TABLE. * Create a special security role called PLUSTRACE. * Grant PLUSTRACE role your user account. 66. How To Set Up Autotrace for a User Account? If an Oracle user wants to use the autotrace feature, you can use the tutorial as an example to create the required table PLAN_TABLE, the required security role PLUSTRACE, and grant the role to that user: SQL> CONNECT HR/retneclgg SQL> @oraclexeapporacleproduct10.2.0server RDBMSADMINUTLXPLAN.SQL Table (HR.PLAN_TABLE) created. SQL> CONNECT / AS SYSDBA SQL> @C:oraclexeapporacleproduct10.2.0server SQLPLUSADMINPLUSTRCE.SQL SQL> drop role plustrace; Role (PLUSTRACE) dropped. SQL> create role plustrace; Role (PLUSTRACE) created. SQL> grant plustrace to dba with admin option; Grant succeeded. SQL> GRANT PLUSTRACE TO HR; Grant succeeded. Remember that PLAN_TABLE table must be created under the user schema HR. 67. How To Get Execution Path Reports on Query Statements? If your user account has autotrace configured by the DBA, you can use the "SET AUTOTRACE ON EXPLAIN" command to turn on execution path reports on query statements. The tutorial exercise bellow shows you a good example: SQL> CONNECT HR/retneclgg SQL> SET AUTOTRACE ON EXPLAIN SQL> SELECT E.LAST_NAME, E.SALARY, J.JOB_TITLE 2 FROM EMPLOYEES E, JOBS J 3 WHERE E.JOB_ID=J.JOB_ID AND E.SALARY>12000; LAST_NAME SALARY JOB_TITLE ----------------- ---------- ----------------------------- King 24000 President Kochhar 17000 Administration Vice President De Haan 17000 Administration Vice President Russell 14000 Sales Manager Partners 13500 Sales Manager Hartstein 13000 Marketing Manager 6 rows selected. 68. How To Get Execution Statistics Reports on Query Statements? If your user account has autotrace configured by the DBA, you can use the "SET AUTOTRACE ON STATISTICS" command to turn on execution statistics reports on query statements. The tutorial exercise bellow shows you a good example: SQL> CONNECT HR/retneclgg SQL> SET AUTOTRACE ON STATISTICS SQL> SELECT E.LAST_NAME, E.SALARY, J.JOB_TITLE 2 FROM EMPLOYEES E, JOBS J 3 WHERE E.JOB_ID=J.JOB_ID AND E.SALARY>12000; LAST_NAME SALARY JOB_TITLE ----------------- ---------- ----------------------------- King 24000 President Kochhar 17000 Administration Vice President De Haan 17000 Administration Vice President Russell 14000 Sales Manager Partners 13500 Sales Manager Hartstein 13000 Marketing Manager 6 rows selected. 69. What Is SQL in Oracle? SQL, SEQUEL (Structured English Query Language), is a language for RDBMS (Relational Database Management Systems). SQL was developed by IBM Corporation. 70. How Many Categories of Data Types in Oracle? Oracles supports the following categories of data types: * Oracle Built-in Datatypes. * ANSI, DB2, and SQL/DS Datatypes. * User-Defined Types. * Oracle-Supplied Types. 71. What Are the Oracle Built-in Data Types? There are 20 Oracle built-in data types, divided into 6 groups: * Character Datatypes - CHAR, NCHAR, NVARCHAR2, VARCHAR2 * Number Datatypes - NUMBER, BINARY_FLOAT, BINARY_DOUBLE * Long and Row Datatypes - LONG, LONG RAW, RAW * Datetime Datatypes - DATE, TIMESTAMP, INTERVAL YEAR TO MONTH, INTERVAL DAY TO SECOND * Large Object Datatypes - BLOB, CLOB, NCLOB, BFILE * Row ID Datatypes - ROWID, UROWID 72. What Are the Differences between CHAR and NCHAR in Oracle? Both CHAR and NCHAR are fixed length character data types. But they have the following differences: * CHAR's size is specified in bytes by default. * NCHAR's size is specified in characters by default. A character could be 1 byte to 4 bytes long depending on the character set used. * NCHAR stores characters in Unicode. 73. What Are the Differences between CHAR and VARCHAR2 in Oracle? The main differences between CHAR and VARCHAR2 are: * CHAR stores values in fixed lengths. Values are padded with space characters to match the specified length. * VARCHAR2 stores values in variable lengths. Values are not padded with any characters. 74. What Are the Differences between NUMBER and BINARY_FLOAT in Oracle? The main differences between NUMBER and BINARY_FLOAT in Oracle are: * NUMBER stores values as fixed-point numbers using 1 to 22 bytes. * BINARY_FLOAT stores values as single precision floating-point numbers. 75. What Are the Differences between DATE and TIMESTAMP in Oracle? The main differences between DATE and TIMESTAMP in Oracle are: * DATE stores values as century, year, month, date, hour, minute, and second. * TIMESTAMP stores values as year, month, day, hour, minute, second, and fractional seconds. 76. What Are the Differences between INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND? The main differences between INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND are: * INTERVAL YEAR TO MONTH stores values as time intervals at the month level. * INTERVAL DAY TO SECOND stores values as time intervals at the fractional seconds level. 77. What Are the Differences between BLOB and CLOB in Oracle? The main differences between BLOB and CLOB in Oracle are: * BLOB stores values as LOB (Large OBject) in bitstreams. * CLOB stores values as LOB (Large OBject) in character steams. 78. What Are the ANSI Data Types Supported in Oracle? The following ANSI data types are supported in Oracle: * CHARACTER(n) / CHAR(n) * CHARACTER VARYING(n) / CHAR VARYING(n) * NATIONAL CHARACTER(n) / NATIONAL CHAR(n) / NCHAR(n) * NATIONAL CHARACTER VARYING(n) / NATIONAL CHAR VARYING(n) / NCHAR VARYING(n) * NUMERIC(p,s) * DECIMAL(p,s) * INTEGER / INT * SMALLINT * FLOAT * DOUBLE PRECISION * REAL 79. How To Write Text Literals in Oracle? There are several ways to write text literals as shown in the following samples: SELECT 'atoztarget.com' FROM DUAL -- The most common format atoztarget.com SELECT 'It''s Sunday!' FROM DUAL -- Single quote escaped It's Sunday! SELECT N'Allo, C''est moi.' FROM DUAL -- National chars Allo, C'est moi. SELECT Q'/It's Sunday!/' FROM DUAL -- Your own delimiter It's Sunday! 80. How To Write Numeric Literals in Oracle? Numeric literals can coded as shown in the following samples: SELECT 255 FROM DUAL -- An integer 255 SELECT -6.34 FROM DUAL -- A regular number -6.34 SELECT 2.14F FROM DUAL -- A single-precision floating point 2.14 SELECT -0.5D FROM DUAL -- A double-precision floating point -0.5 81. How To Write Date and Time Literals in Oracle? Date and time literals can coded as shown in the following samples: SELECT DATE '2002-10-03' FROM DUAL -- ANSI date format 03-OCT-07 SELECT TIMESTAMP '0227-01-31 09:26:50.124' FROM DUAL 31-JAN-07 09.26.50.124000000 AM -- This is ANSI format 82. How To Write Date and Time Interval Literals in Oracle? Date and time interval literals can coded as shown in the following samples: SELECT DATE '2002-10-03' + INTERVAL '123-2' YEAR(3) TO MONTH FROM DUAL -- 123 years and 2 months is added to 2002-10-03 03-DEC-25 SELECT DATE '2002-10-03' + INTERVAL '123' YEAR(3) FROM DUAL -- 123 years is added to 2002-10-03 03-OCT-25 SELECT DATE '2002-10-03' + INTERVAL '299' MONTH(3) FROM DUAL -- 299 months years is added to 2002-10-03 03-SEP-27 SELECT TIMESTAMP '1997-01-31 09:26:50.124' + INTERVAL '4 5:12:10.222' DAY TO SECOND(3) FROM DUAL 04-FEB-97 02.39.00.346000000 PM SELECT TIMESTAMP '1997-01-31 09:26:50.124' + INTERVAL '4 5:12' DAY TO MINUTE FROM DUAL 04-FEB-97 02.38.50.124000000 PM SELECT TIMESTAMP '1997-01-31 09:26:50.124' + INTERVAL '400 5' DAY(3) TO HOUR FROM DUAL 07-MAR-98 02.26.50.124000000 PM SELECT TIMESTAMP '1997-01-31 09:26:50.124' + INTERVAL '400' DAY(3) FROM DUAL 07-MAR-98 09.26.50.124000000 AM SELECT TIMESTAMP '1997-01-31 09:26:50.124' + INTERVAL '11:12:10.2222222' HOUR TO SECOND(7) FROM DUAL 31-JAN-97 08.39.00.346222200 PM 83. How To Convert Numbers to Characters in Oracle? You can convert numeric values to characters by using the TO_CHAR() function as shown in the following examples: SELECT TO_CHAR(4123.4570) FROM DUAL 123.457 SELECT TO_CHAR(4123.457, '$9,999,999.99') FROM DUAL $4,123.46 SELECT TO_CHAR(-4123.457, '9999999.99EEEE') FROM DUAL -4.12E+03 84. How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the TO_NUMBER() function as shown in the following examples: SELECT TO_NUMBER('4123.4570') FROM DUAL 4123.457 SELECT TO_NUMBER(' $4,123.46','$9,999,999.99') FROM DUAL 4123.46 SELECT TO_NUMBER(' -4.12E+03') FROM DUAL -4120 85. How To Convert Dates to Characters in Oracle? You can convert dates to characters using the TO_CHAR() function as shown in the following examples: SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY') FROM DUAL; -- SYSDATE returns the current date 07-MAY-2006 SELECT TO_CHAR(SYSDATE, 'YYYY/MM/DD') FROM DUAL; 2006/05/07 SELECT TO_CHAR(SYSDATE, 'MONTH DD, YYYY') FROM DUAL; MAY 07, 2006 SELECT TO_CHAR(SYSDATE, 'fmMONTH DD, YYYY') FROM DUAL; May 7, 2006 SELECT TO_CHAR(SYSDATE, 'fmDAY, MONTH DD, YYYY') FROM DUAL; SUNDAY, MAY 7, 2006 86. How To Convert Characters to Dates in Oracle? You can convert dates to characters using the TO_DATE() function as shown in the following examples: SELECT TO_DATE('07-MAY-2006', 'DD-MON-YYYY') FROM DUAL; 07-MAY-06 SELECT TO_DATE('2006/05/07 ', 'YYYY/MM/DD') FROM DUAL; 07-MAY-06 SELECT TO_DATE('MAY 07, 2006', 'MONTH DD, YYYY') FROM DUAL; 07-MAY-06 SELECT TO_DATE('May 7, 2006', 'fmMONTH DD, YYYY') FROM DUAL; 07-MAY-06 SELECT TO_DATE('SUNDAY, MAY 7, 2006', 'fmDAY, MONTH DD, YYYY') FROM DUAL; 07-MAY-06 87. How To Convert Times to Characters in Oracle? You can convert dates to characters using the TO_CHAR() function as shown in the following examples: SELECT TO_CHAR(SYSDATE, 'HH:MI:SS') FROM DUAL; 04:49:49 SELECT TO_CHAR(SYSDATE, 'HH24:MI:SS.FF') FROM DUAL; -- Error: SYSDATE has no fractional seconds SELECT TO_CHAR(SYSTIMESTAMP, 'HH24:MI:SS.FF9') FROM DUAL; 16:52:57.847000000 SELECT TO_CHAR(SYSDATE, 'SSSSS') FROM DUAL; -- Seconds past midnight 69520 88. How To Convert Characters to Times in Oracle? You can convert dates to characters using the TO_CHAR() function as shown in the following examples: SELECT TO_CHAR(TO_DATE('04:49:49', 'HH:MI:SS'), 'DD-MON-YYYY HH24:MI:SS') FROM DUAL; -- Default date is the first day of the current month 01-MAY-2006 04:49:49 SELECT TO_CHAR(TO_TIMESTAMP('16:52:57.847000000', 'HH24:MI:SS.FF9'), 'DD-MON-YYYY HH24:MI:SS.FF9') FROM DUAL; 01-MAY-2006 16:52:57.847000000 SELECT TO_CHAR(TO_DATE('69520', 'SSSSS'), 'DD-MON-YYYY HH24:MI:SS') FROM DUAL; 01-MAY-2006 19:18:40 89. What Is NULL value in Oracle? NULL is a special value representing "no value" in all data types. NULL can be used on in operations like other values. But most operations has special rules when NULL is involved. The tutorial exercise below shows you some examples: SET NULL 'NULL'; -- Make sure NULL is displayed SELECT NULL FROM DUAL; N - N U L L SELECT NULL + NULL FROM DUAL; NULL+NULL ---------- NULL SELECT NULL + 7 FROM DUAL; NULL+7 ---------- NULL SELECT NULL * 7 FROM DUAL; NULL*7 ---------- NULL SELECT NULL || 'A' FROM DUAL; N - A SELECT NULL + SYSDATE FROM DUAL; NULL+SYSD --------- NULL 90. How To Use NULL as Conditions in Oracle? If you want to compare values against NULL as conditions, you should use the "IS NULL" or "IS NOT NULL" operator. Do not use "=" or "" against NULL. The sample script below shows you some good examples: SELECT 'A' IS NULL FROM DUAL; -- Error: Boolean is not data type. -- Boolean can only be used as conditions SELECT CASE WHEN 'A' IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; FALSE SELECT CASE WHEN '' IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 0 IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; FALSE SELECT CASE WHEN NULL IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 'A' = NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "=" FALSE SELECT CASE WHEN 'A' NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "" FALSE SELECT CASE WHEN NULL = NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "=" FALSE 91. How To Concatenate Two Text Values in Oracle? There are two ways to concatenate two text values together: * CONCAT() function. * '||' operation. Here is some examples on how to use them: SELECT 'ggl' || 'Center' || '.com' FROM DUAL; atoztarget.com SELECT CONCAT('atoztarget','.com') FROM DUAL; atoztarget.com 92. How To Increment Dates by 1 in Oracle? If you have a date, and you want to increment it by 1. You can do this by adding the date with a date interval. You can also do this by adding the number 1 directly on the date. The tutorial example below shows you how to adding numbers to dates, and take date differences: SELECT TO_DATE('30-APR-06') + 1 FROM DUAL; -- Adding 1 day to a date 01-MAY-06 SELECT TO_DATE('01-MAY-06') - TO_DATE('30-APR-06') FROM DUAL; -- Taking date differences 1 SELECT SYSTIMESTAMP + 1 FROM DUAL; -- The number you add is always in days. 08-MAY-06 SELECT TO_CHAR(SYSTIMESTAMP+1,'DD-MON-YYYY HH24:MI:SS.FF3') FROM DUAL; -- Error: Adding 1 to a timestamp makes it a date. 93. How To Calculate Date and Time Differences in Oracle? If you want to know how many years, months, days and seconds are there between two dates or times, you can use the date and time interval expressions: YEAR ... TO MONTH and DAY ... TO SECOND. The tutorial exercise below gives you some good examples: SELECT (TO_DATE('01-MAY-2006 16:52:57','DD-MON-YYYY HH24:MI:SS') - TO_DATE('31-JAN-1897 09:26:50','DD-MON-YYYY HH24:MI:SS')) YEAR(4) TO MONTH FROM DUAL; -- 109 years and 3 months 109-3 SELECT (TO_DATE('01-MAY-2006 16:52:57','DD-MON-YYYY HH24:MI:SS') - TO_DATE('31-JAN-1897 09:26:50','DD-MON-YYYY HH24:MI:SS')) DAY(9) TO SECOND FROM DUAL; -- 39901 days and some seconds 39901 7:26:7.0 SELECT (TO_TIMESTAMP('01-MAY-2006 16:52:57.847', 'DD-MON-YYYY HH24:MI:SS.FF3') - TO_TIMESTAMP('31-JAN-1897 09:26:50.124', 'DD-MON-YYYY HH24:MI:SS.FF3')) YEAR(4) TO MONTH FROM DUAL; -- 109 years and 3 months 109-3 SELECT (TO_TIMESTAMP('01-MAY-2006 16:52:57.847', 'DD-MON-YYYY HH24:MI:SS.FF3') - TO_TIMESTAMP('31-JAN-1897 09:26:50.124','DD-MON-YYYY HH24:MI:SS.FF3')) DAY(9) TO SECOND FROM DUAL; -- 39 94. How To Use IN Conditions in Oracle? An IN condition is single value again a list of values. It returns TRUE, if the specified value is in the list. Otherwise, it returns FALSE. Some examples are given in the script below: SELECT CASE WHEN 3 IN (1,2,3,5) THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 3 NOT IN (1,2,3,5) THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; FALSE SELECT CASE WHEN 'Y' IN ('F','Y','I') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE 95. How To Use LIKE Conditions in Oracle? LIKE condition is also called pattern patch. There 3 main rules on using LIKE condition: * '_' is used in the pattern to match any one character. * '%' is used in the pattern to match any zero or more characters. * ESCAPE clause is used to provide the escape character in the pattern. The following script provides you some good pattern matching examples: SELECT CASE WHEN 'atoztarget.com' LIKE '%Center%' THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 'atoztarget.com' LIKE '%CENTER%' THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Case sensitive by default FALSE SELECT CASE WHEN 'atoztarget.com' LIKE '%Center_com' THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN '100% correct' LIKE '100% %' ESCAPE '' THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE 96. How To Use Regular Expression in Pattern Match Conditions in Oracle? If you have a pattern that is too complex for LIKE to handle, you can use the regular expression pattern patch function: REGEXP_LIKE(). The following script provides you some good examples: SELECT CASE WHEN REGEXP_LIKE ('atoztarget.com', '.*ggl.*','i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN REGEXP_LIKE ('atoztarget.com', '.*com$','i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN REGEXP_LIKE ('atoztarget.com', '^F.*','i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE 97. What Are DDL Statements in Oracle? DDL (Data Definition Language) statements are statements to create and manage data objects in the database. The are 3 primary DDL statements: CREATE - Creating a new database object. ALTER - Altering the definition of an existing data object. DROP - Dropping an existing data object. 98. How To Create a New Table in Oracle? If you want to create a new table in your own schema, you can log into the server with your account, and use the CREATE TABLE statement. The following script shows you how to create a table: >.binsqlplus /nolog SQL> connect HR/atoztarget Connected. SQL> CREATE TABLE tip (id NUMBER(5) PRIMARY KEY, subject VARCHAR(80) NOT NULL, description VARCHAR(256) NOT NULL, create_date DATE DEFAULT (sysdate)); Table created. This scripts creates a testing table called "tip" with 4 columns in the schema associated with the log in account "HR". 99. How To Create a New Table by Selecting Rows from Another Table? Let's say you have a table with many data rows, now you want to create a backup copy of this table of all rows or a subset of them, you can use the CREATE TABLE...AS SELECT statement to do this. Here is an example script: >.binsqlplus /nolog SQL> connect HR/atoztarget Connected. SQL> CREATE TABLE emp_dept_10 2 AS SELECT * FROM employees WHERE department_id=10; Table created. SQL> SELECT first_name, last_name, salary 2 FROM emp_dept_10; FIRST_NAME LAST_NAME SALARY -------------------- ------------------------- ---------- Jennifer Whalen 4400 As you can see, this SQL scripts created a table called "emp_dept_10" using the same column definitions as the "employees" table and copied data rows of one department. This is really a quick and easy way to create a table. 100. How To Add a New Column to an Existing Table in Oracle? If you have an existing table with existing data rows, and want to add a new column to that table, you can use the ALTER TABLE ... ADD statement to do this. Here is an example script: SQL> connect HR/atoztarget Connected. SQL> CREATE TABLE emp_dept_110 2 AS SELECT * FROM employees WHERE department_id=110; Table created. SQL> ALTER TABLE emp_dept_110 ADD (vacation NUMBER); Table altered. SQL> SELECT first_name, last_name, vacation 2 FROM emp_dept_110; FIRST_NAME LAST_NAME VACATION -------------------- ------------------------- ---------- Shelley Higgins William Gietz This SQL script added a new column called "vacation" to the "emp_dept_110" table. NULL values were added to this column on all existing data rows. ORACLE Database Questions and Answers Pdf Download Read the full article
0 notes
Link
Either you are a fresher or experienced professional, we have tried to answer your queries.
0 notes
Link
0 notes
Link
0 notes
Link
1 note
·
View note